Prevent disconnect from within handler (and style cleanup)

This commit is contained in:
Vurich
2017-06-30 12:10:12 +02:00
parent 5eba9078fc
commit 17de29e69a
3 changed files with 14 additions and 19 deletions

View File

@@ -821,12 +821,15 @@ impl LightProtocol {
}));
let any_kept = self.handlers.iter().map(
|handler|
handler.on_connect(&Ctx {
peer: *peer,
io: io,
proto: self,
}, &status, &capabilities)
|handler| handler.on_connect(
&Ctx {
peer: *peer,
io: io,
proto: self,
},
&status,
&capabilities
)
).fold(PeerStatus::Kept, PeerStatus::bitor);
if any_kept == PeerStatus::Unkept {