• Kirill Smelkov's avatar
    go/neo/neonet: Rework handshake to differentiate client and server parts · e407f725
    Kirill Smelkov authored
    Previously we were doing handshake symmetrically: both client and server
    were transmitting hello and receiving peer's hello simultaneously.
    However this does not allow server to adjust its behaviour depending on
    which client (protocol version, protocol encoding, ...) is connecting to it.
    
    -> Rework handshake so that client always sends its hello first, and
    only then the server side replies. This matches actual NEO/py behaviour:
    
    https://lab.nexedi.com/nexedi/neoppod/blob/v1.12-67-g261dd4b4/neo/lib/connector.py#L293-294
    
    even though the "NEO protocol" states that
    
    	Handshake transmissions are not ordered with respect to each other and can go in parallel.
    
    	( https://neo.nexedi.com/P-NEO-Protocol.Specification.2019?portal_skin=CI_slideshow#/9/2 )
    
    If I recall correctly that sentence was authored by me in 2018 based on
    previous understanding of should-be full symmetry in-between client and
    server.
    
    However soon we are going to teach server sides to autodetect client
    encoding and adjust server to talk to client via its preferred way.
    This needs handshake for client and server to be differentiated.
    
    The protocol needs to be adjusted as well. However I'm not sure it is
    going to happen...
    e407f725
xcontext.go 1.66 KB