Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
chore(network): upgrade tentacle (#265)
Browse files Browse the repository at this point in the history
* chore(network): upgrade tentacle

* fix(network): compilation after upgraded tentacle
  • Loading branch information
zeroqn authored Apr 29, 2020
1 parent a12124a commit 1521f39
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions core/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ rand = "0.7"
serde = "1.0"
serde_derive = "1.0"
snap = "0.2"
tentacle = { git = "https://github.com/zeroqn/p2p", branch = "muta-disc", features = [ "flatc" ]}
tentacle-ping = { git = "https://github.com/zeroqn/p2p", branch = "muta-disc", features = [ "flatc" ]}
tentacle-discovery = { git = "https://github.com/zeroqn/p2p", branch = "muta-disc", features = [ "flatc" ]}
tentacle-identify = { git = "https://github.com/zeroqn/p2p", branch = "muta-disc", features = [ "flatc" ]}
tentacle = { git = "https://github.com/zeroqn/p2p", rev = "77b9f391", features = [ "flatc" ]}
tentacle-ping = { git = "https://github.com/zeroqn/p2p", rev = "77b9f391", features = [ "flatc" ]}
tentacle-discovery = { git = "https://github.com/zeroqn/p2p", rev = "77b9f391", features = [ "flatc" ]}
tentacle-identify = { git = "https://github.com/zeroqn/p2p", rev = "77b9f391", features = [ "flatc" ]}
tokio = { version = "0.2", features = ["macros", "rt-core"]}
hostname = "0.3"

Expand Down
7 changes: 3 additions & 4 deletions core/network/src/connection/keeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ impl ConnectionServiceKeeper {
PeerIdNotMatch => ConnectionErrorKind::PeerIdNotMatch,
DNSResolverError(e) => ConnectionErrorKind::DNSResolver(Box::new(e)),
HandshakeError(e) => ConnectionErrorKind::SecioHandshake(Box::new(e)),
ServiceProtoHandleBlock
| SessionProtoHandleBlock(_)
| ServiceProtoHandleAbnormallyClosed
| SessionProtoHandleAbnormallyClosed(_) => ConnectionErrorKind::ProtocolHandle,
ProtoHandleBlock(_) | ProtoHandleAbnormallyClosed(_) => {
ConnectionErrorKind::ProtocolHandle
}
};

let connect_failed = PeerManagerEvent::ConnectFailed { addr, kind };
Expand Down
16 changes: 8 additions & 8 deletions core/network/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ impl<P: NetworkProtocol> ConnectionService<P> {
yamux_config.accept_backlog = max;
}

if let Some(size) = config.send_buffer_size {
yamux_config.send_buffer_size = size;
}

if let Some(size) = config.recv_buffer_size {
yamux_config.recv_buffer_size = size;
}

if let Some(timeout) = config.write_timeout {
yamux_config.connection_write_timeout = Duration::from_secs(timeout);
}
Expand All @@ -93,6 +85,14 @@ impl<P: NetworkProtocol> ConnectionService<P> {
builder = builder.max_frame_length(max);
}

if let Some(size) = config.send_buffer_size {
builder = builder.set_send_buffer_size(size);
}

if let Some(size) = config.recv_buffer_size {
builder = builder.set_recv_buffer_size(size);
}

for proto_meta in protocol.metas().into_iter() {
debug!("network: connection: insert protocol {}", proto_meta.name());
builder = builder.insert_protocol(proto_meta);
Expand Down

0 comments on commit 1521f39

Please sign in to comment.