Syncing fix (#1320)
* Fixed aborting peer for expired session * Don't ban for usesless
This commit is contained in:
committed by
Gav Wood
parent
5e1e3ce857
commit
ec654feaf8
@@ -139,6 +139,7 @@ impl<Socket: GenericSocket> GenericConnection<Socket> {
|
||||
},
|
||||
Ok(Some(size)) if (buf.position() as usize) == send_size => {
|
||||
self.stats.inc_send(size);
|
||||
trace!(target:"network", "{}: Wrote {} bytes", self.token, send_size);
|
||||
Ok(WriteStatus::Complete)
|
||||
},
|
||||
Ok(Some(_)) => { panic!("Wrote past buffer");},
|
||||
|
||||
@@ -250,7 +250,7 @@ impl<'s, Message> NetworkContext<'s, Message> where Message: Send + Sync + Clone
|
||||
self.io.message(NetworkIoMessage::Disconnect(peer));
|
||||
}
|
||||
|
||||
/// Sheck if the session is till active.
|
||||
/// Check if the session is still active.
|
||||
pub fn is_expired(&self) -> bool {
|
||||
self.session.as_ref().map(|s| s.lock().unwrap().expired()).unwrap_or(false)
|
||||
}
|
||||
@@ -664,7 +664,6 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
|
||||
Err(e) => {
|
||||
trace!(target: "network", "Session read error: {}:{:?} ({:?}) {:?}", token, s.id(), s.remote_addr(), e);
|
||||
match e {
|
||||
UtilError::Network(NetworkError::Disconnect(DisconnectReason::UselessPeer)) |
|
||||
UtilError::Network(NetworkError::Disconnect(DisconnectReason::IncompatibleProtocol)) => {
|
||||
if let Some(id) = s.id() {
|
||||
self.nodes.write().unwrap().mark_as_useless(id);
|
||||
|
||||
Reference in New Issue
Block a user