[Unison-hackers] version negotiation

Tõivo Leedjärv toivol at gmail.com
Wed Jun 30 13:00:10 EDT 2021


On Wed, Jun 30, 2021 at 6:42 PM Tõivo Leedjärv <toivol at gmail.com> wrote:
>
> I'll keep thinking about it. There could be some tricky ways, abusing
> the current protocol, like sending two 'write tokens' instead of
> one...

I looked in the code. This may very well be a perfectly working
solution. Sending multiple 'write tokens' in sequence should not break
the old clients.

Let's say it works like this.

Old server:
1. Sends header string.
2. <old protocol is enabled> Sends write token.
3. Old protocol communication.

New server:
1. Sends old header string.
2. <old protocol is enabled> Sends, let's say 5 write tokens.
3a. Old client will process all 5 separately and continue old protocol
communication normally.
3b. New client will know it is a magic signal and switch to protocol
negotiation mode.

This works because the 'write token' does not depend on OCaml version
or Marshal module.

That's the theory. It is easy enough to try out, so that's what I'll do.


More information about the Unison-hackers mailing list