Multiple cluster configs on the same connection and BEP

I want get rid of the need to drop connections whenever config changes relevant to folders happen. It looks pretty straight forward to do, but it’s against BEP v1:

Additional Cluster Config messages MUST NOT be sent after the initial exchange.

My proposal is to allow multiple CCs, which means BEP v2. To avoid a major version bump in Syncthing, add a field to the hello message where a client can signify which versions of the BEP it speaks, going ahead with the highest common version or dropping the connection if incompatible. It’s very simple to support both BEP v1 (single CC) and v2, that’s just one condition that decides whether a second CC is sent or the connection closed and one in the protocol connection on whether to allow multiple CCs or not. Thus a release with this improvement can still sync with older releases (missing hello field means BEP v1).

Does that sound like a sensible plan?

1 Like

Definitely sounds that you’ve not just found a cool improvement but also took the time to think about possible impacts on compatibility and their solution already. Pretty good and sensible plan from my (non dev) point of view :+1:.

So I tried to do the same thing too, but also stopped for the same reason.

You could add a new message type, but imho I’d just change the spec without changing the version. It’s not like we have a lot of implementations, or that this is tragically complicated if added now.

I don’t think you need to do anything special. Change the spec to allow it. Old implementations (our implementations) will get the message, reject it as a protocol error and close the connection, thus becoming a fallback to previous behavior. New implementations will keep rocking.

1 Like