Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is part of #166
What?
We update TCP.Server to set DEVp2p session as active, and to check the session's status when other packets come in. When any other packet comes in we forward it to the subscribers.
We also update all the function names in
DEVp2p
fromhandshake
tohello
to reduce confusion between encrypted handshake and the DEVp2p protocol handshake (thehello
part).For the future/rest of messages
Subscribers is a concept that has been in
TCP.Server
for quite some time even though we don't really have subscribers (other than theSync
module that is not currently being used). For that reason, I think we can handle the rest of the messages (i.e. messages other than encrypted handshake and DEVp2p Hello messages) in one of two ways (in the future):We continue having modules/servers that subscribe to TCP connection. The TCP.Server handles encrypted handshake and protocol handshake, then forwards all other messages.
We simply have the TCP module (or some other module that uses a TCP connection, which requires a lot of refactoring) handle all messages. It first ensures that encrypted handshake and protocol handshakes are performed and then makes use of
handle/1
in packets to deal with data (essentially removing thenotify_subscribers
part).It's worth noting that (2) works well for inbound connections (since they mostly receive a message and respond to it without much regard to state). But outbound connections (such as the Sync) module we may want to treat differently.