Fix peer dropping (#2780)

It turns out that we drop connection if we fail to process a message
because of chain/store/internal error, eg we have a header already, so
we refuse it and drop the peer.
This pr doesn't forward this error to the peer error channel so the
connection will not be dropped.
This commit is contained in:
hashmap
2019-04-26 20:22:07 +02:00
committed by GitHub
parent 81a6af9624
commit 304ae444ab
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -51,6 +51,10 @@ macro_rules! try_break {
match $inner {
Ok(v) => Some(v),
Err(Error::Connection(ref e)) if e.kind() == io::ErrorKind::WouldBlock => None,
Err(Error::Store(_))
| Err(Error::Chain(_))
| Err(Error::Internal)
| Err(Error::NoDandelionRelay) => None,
Err(e) => {
let _ = $chan.send(e);
break;
+1 -1
View File
@@ -61,7 +61,7 @@ macro_rules! connection {
($holder:expr) => {
match $holder.connection.as_ref() {
Some(conn) => conn.lock(),
None => return Err(Error::Internal),
None => return Err(Error::ConnectionClose),
}
};
}