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

Add the concept of message channels to the node. #1837

Merged
merged 2 commits into from Mar 19, 2019

Conversation

@clemahieu
Copy link
Collaborator

commented Mar 16, 2019

All transport related code is in the node/transport directory.
There is a generic base class nano::transport::channel that represents a bi-directional messaging channel that can be subclassed by different transport layer types.
UDP-channels are managed by a class nano::transport::udp_channels which largely replaces peer_container.
Generic network related functionality is handled by nano::network and the nano::peer_container class has been removed.
UDP-specific functionality such as keepalives and UDP handshaking is handled by the udp_channels class
TCP channels have been added and the bootstrapping functionality has been rewritten to push messages through these channels.

Add the concept of message channels to the node.
All transport related code is in the node/transport directory.
There is a generic base class nano::transport::channel that represents a bi-directional messaging channel that can be subclassed by different transport layer types.
UDP-channels are managed by a class nano::transport::udp_channels which largely replaces peer_container.
Generic network related functionality is handled by nano::network and the nano::peer_container class has been removed.
UDP-specific functionality such as keepalives and UDP handshaking is handled by the udp_channels class
TCP channels have been added and the bootstrapping functionality has been rewritten to push messages through these channels.

@zhyatt zhyatt added the enhancement label Mar 16, 2019

@zhyatt zhyatt added this to the V19.0 milestone Mar 16, 2019

@cryptocode

This comment has been minimized.

Copy link
Collaborator

commented Mar 18, 2019

Tests and node on live runs fine in my testing so far.

A couple of questions:

a) Since the type is now named transport#channel, should the parameters and locals be called channel instead of sink as well?

b) For code like below, I wonder if send_buffer for TCP needs to be queued, as it calls async_write, and there can only be one write operation in flight at the same time per stream.

	for (auto & vote : votes)
	{
		nano::confirm_ack confirm (vote);
		auto vote_bytes = confirm.to_bytes ();
		sink_a.send_buffer (vote_bytes, nano::stat::detail::confirm_ack);
	}

(These cases are currently UDP-only, so no issue right now)

@clemahieu

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 19, 2019

Yes I'll change the references from sink to channel.

The TCP operations will need to be queued yes, the existing code self-limited so there were never overlapping write operations but to make it more generic it should be queued and queue length limited.

We'll also have to devise some way for the bootstrap operations to lock the channel while their operation is being performed since they're not message-length operations.

Renaming all references of sink to channel and renaming transport::ch…
…annel::sink to transport::channell::send.
@cryptocode
Copy link
Collaborator

left a comment

LGTM

@clemahieu clemahieu merged commit e36a044 into master Mar 19, 2019

2 of 3 checks passed

continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@clemahieu clemahieu deleted the message_channel branch Mar 20, 2019

@zhyatt zhyatt added this to CP2 (2019-03-27) in V19 Mar 21, 2019

guilhermelawless added a commit to guilhermelawless/nano-node that referenced this pull request Apr 15, 2019

Add the concept of message channels to the node. (nanocurrency#1837)
* Add the concept of message channels to the node.
All transport related code is in the node/transport directory.
There is a generic base class nano::transport::channel that represents a bi-directional messaging channel that can be subclassed by different transport layer types.
UDP-channels are managed by a class nano::transport::udp_channels which largely replaces peer_container.
Generic network related functionality is handled by nano::network and the nano::peer_container class has been removed.
UDP-specific functionality such as keepalives and UDP handshaking is handled by the udp_channels class
TCP channels have been added and the bootstrapping functionality has been rewritten to push messages through these channels.

* Renaming all references of sink to channel and renaming transport::channel::sink to transport::channell::send.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.