Re: version negotiation
Tõivo Leedjärv <[email protected]> Wed, 30 Jun 2021 14:19:19 +0200
| Newsgroups | gmane.network.unison.devel |
|---|---|
| Message-ID | <CAALvpZRg04fF+5vRNysbcSxqbMkMA==BEq71fKddS1DAzhOeWA@mail.gmail.com> |
On Wed, Jun 30, 2021 at 1:38 AM Greg Troxel <[email protected]> wrote: > > My understanding is that right now, unison simply assumes that the > remote side speaks the same protocol, and things deteriorate from there > if it is not true (because of a 2.48/2.51 mismatch). Pretty much, but there is a hello string sent by the server which the client verifies. If there is a 2.48/2.51 mismatch then the connection is terminated immediately. There is no OCaml version check (just that it is >= 4.02 something). That may work or fail in mysterious ways. > #507, as I understand it, causes the server to start off with proto > version negotation instead, and the server can be configured not to, so > that old clients can connect. Correct. Or, in case of ssh, with the latest commit the client can actually announce that it supports proto version negotiation and if not, the server will treat it as an old client. As it is, only socket server users will have to do anything, and only if they know they have to support clients < 2.51.5. For all other scenarios, compatibility is ensured automatically. > So, I am wondering if instead, we say: > > 2.51.5 will simply announce as 2.51.5 Right now, only server announces itself. Clients don't. And, right now, all existing clients expect to receive a _fixed_ hello string (which is "Unison 2.51 with OCaml >= 4.01.2\n"). > 2.51.5, if it sees the remote as 2.51.5 or higher, instead of starting > the old protocol, will send the first message of the "determine > supported proto versions negotiation protocol". If it sees something > earlier, it will just do the old protocol. Right now, the server announces itself and then immediately starts the OCaml-dependent protocol. This makes it very difficult for client to say anything. This, combined with the fixed hello string above, makes adding any auto-detection rather difficult. That's why the auto-detection trick over ssh uses command line arguments. I thought about this approach -- fine, let the server start its protocol. And then the client announces itself/negotiates _within_ the existing protocol. Alas, this won't work because the existing protocol is OCaml-dependent and so it can't be relied on for even the simplest step like announcing the client.