Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set DEVp2p session as active #252

Merged
merged 1 commit into from
Jul 17, 2018
Merged

Set DEVp2p session as active #252

merged 1 commit into from
Jul 17, 2018

Conversation

germsvel
Copy link
Contributor

@germsvel germsvel commented Jul 13, 2018

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 from handshake to hello to reduce confusion between encrypted handshake and the DEVp2p protocol handshake (the hello 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 the Sync 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):

  1. We continue having modules/servers that subscribe to TCP connection. The TCP.Server handles encrypted handshake and protocol handshake, then forwards all other messages.

  2. 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 the notify_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.

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.

Subscribers is a concept that has been in `TCP.Server` for quite some
time even though we don't really have subscribers (other than the `Sync`
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:

1. We continue having modules/servers that subscribe to TCP connection.
The TCP.Server handles encrypted handshake and protocol handshake, then
forwards all other messages.

2. 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 the `notify_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.
@ghost ghost assigned germsvel Jul 13, 2018
@ghost ghost added the status: in progress label Jul 13, 2018
@germsvel germsvel requested review from masonforest and ayrat555 July 13, 2018 18:54
@germsvel germsvel added this to the Simple node (MVP) milestone Jul 13, 2018
@germsvel germsvel merged commit 5b01419 into master Jul 17, 2018
@ghost ghost removed the status: in progress label Jul 17, 2018
@germsvel germsvel deleted the gv-devp2p-active-session branch July 17, 2018 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants