Add support for protocol versions
We can't guarantee that libeis/libei/libreis are in lockstep, so eventually we need to declare the protocol stable. So let's exchange version numbers - server sends the version it supports, client picks which one it wants. Since libreis operates on the same connection it too needs a version negotiation, separate from the client. And since there may be multiple libreis intermediaries, this needs to be wrapped in a transaction.
So with this patchset:
- the server immediately sends the
Version
message when it obtains a socket. This way libreis or libei already have that message ready and waiting - if present, libreis wraps every call into
ConfigureStart
/ConfigureFinish
with the libreis supported version - libei connects with the wanted version
If libreis took the Version
message off the socket, libeis will send GetVersion
.
Missing, because not implemented yet:
- libreis doesn't have a
reis_dispatch()
. This is fine for now because all we do here is oneshot and we don't need version negotiation (everything is v1). Eventually we need this is libreis ever becomes complicated enough that we need to actually communicate with the server - if the socket is not
O_NONBLOCK
, libei may now block. meh? could fix this but not sure this is needed anywhere.
Fixes #17 (closed), see also #24 (closed)