Report when peer is clogged (#1528)

This commit is contained in:
Pierre Krieger
2019-01-23 14:30:20 +01:00
committed by Gav Wood
parent 28c37ef419
commit cd86643f33
7 changed files with 107 additions and 16 deletions
+14 -3
View File
@@ -160,6 +160,14 @@ pub enum BehaviourOut {
data: Bytes,
},
/// A substream with a remote is clogged. We should avoid sending more data to it if possible.
Clogged {
/// Id of the peer the message came from.
peer_id: PeerId,
/// Protocol which generated the message.
protocol_id: ProtocolId,
},
/// We have obtained debug information from a peer.
Identified {
/// Id of the peer that has been identified.
@@ -174,13 +182,16 @@ impl From<CustomProtosOut> for BehaviourOut {
match other {
CustomProtosOut::CustomProtocolOpen { protocol_id, version, peer_id, endpoint } => {
BehaviourOut::CustomProtocolOpen { protocol_id, version, peer_id, endpoint }
},
}
CustomProtosOut::CustomProtocolClosed { protocol_id, peer_id, result } => {
BehaviourOut::CustomProtocolClosed { protocol_id, peer_id, result }
},
}
CustomProtosOut::CustomMessage { protocol_id, peer_id, data } => {
BehaviourOut::CustomMessage { protocol_id, peer_id, data }
},
}
CustomProtosOut::Clogged { protocol_id, peer_id } => {
BehaviourOut::Clogged { protocol_id, peer_id }
}
}
}
}