You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NTCP handshake messages don't have IDs, and are identified based on send order. As a result, there are currently two state machines inside the NTCP engine:
IBHandshakeState and OBHandshakeState in HandshakeTransport.state, which handle the higher-level state transformations.
HandshakeState in InboundHandshakeCodec and OutboundHandshakeCodec, which defines which handshake message the codec is listening for or expects to be sent.
The reason for having two separate state machines is that HandshakeTransport calls stream.framed() to get a Framed transport that wraps the stream with a codec, and then itself wraps that transport. This makes it tricky to have a single state machine that is used by both parts of the engine (bearing in mind that I wrote the engine partly as an exercise in learning Rust). But having two state machines that are supposed to always be in sync is clearly prone to bugs.
We should deduplicate the state machine. I can see two ways of doing this:
Give a remote reference to the HandshakeTransport state machine to *HandshakeCodec (which is probably easier than I think it is using something like RefCell, which I still need to learn about).
Remove the use of Framed by implementing stream framing in HandshakeTransport, and pass the state machine through to the codec.
The text was updated successfully, but these errors were encountered:
NTCP handshake messages don't have IDs, and are identified based on send order. As a result, there are currently two state machines inside the NTCP engine:
IBHandshakeState
andOBHandshakeState
inHandshakeTransport.state
, which handle the higher-level state transformations.HandshakeState
inInboundHandshakeCodec
andOutboundHandshakeCodec
, which defines which handshake message the codec is listening for or expects to be sent.The reason for having two separate state machines is that
HandshakeTransport
callsstream.framed()
to get aFramed
transport that wraps the stream with a codec, and then itself wraps that transport. This makes it tricky to have a single state machine that is used by both parts of the engine (bearing in mind that I wrote the engine partly as an exercise in learning Rust). But having two state machines that are supposed to always be in sync is clearly prone to bugs.We should deduplicate the state machine. I can see two ways of doing this:
HandshakeTransport
state machine to*HandshakeCodec
(which is probably easier than I think it is using something likeRefCell
, which I still need to learn about).Framed
by implementing stream framing inHandshakeTransport
, and pass the state machine through to the codec.The text was updated successfully, but these errors were encountered: