Don't queue messages after shutdown (#1476)

This commit is contained in:
Pierre Krieger
2019-01-19 12:37:07 +01:00
committed by Gav Wood
parent a69a09a165
commit f1f32ac620
@@ -103,10 +103,15 @@ impl<TSubstream> RegisteredProtocolSubstream<TSubstream> {
/// After calling this, the stream is guaranteed to finish soon-ish.
pub fn shutdown(&mut self) {
self.is_closing = true;
self.send_queue.clear();
}
/// Sends a message to the substream.
pub fn send_message(&mut self, data: Bytes) {
if self.is_closing {
return
}
self.send_queue.push_back(data);
// If the length of the queue goes over a certain arbitrary threshold, we print a warning.