Browse Source

Refactored SctpTransport::closeStream()

Paul-Louis Ageneau 3 years ago
parent
commit
220bb69635
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/impl/sctptransport.cpp

+ 5 - 3
src/impl/sctptransport.cpp

@@ -436,9 +436,11 @@ bool SctpTransport::flush() {
 }
 
 void SctpTransport::closeStream(unsigned int stream) {
-	// This method must not call the buffered callback synchronously, so call send() from processor
-	mProcessor.enqueue(&SctpTransport::send, this,
-	                   make_message(0, Message::Reset, to_uint16(stream)));
+	std::lock_guard lock(mSendMutex);
+
+	// This method must not call the buffered callback synchronously
+	mSendQueue.push(make_message(0, Message::Reset, to_uint16(stream)));
+	mProcessor.enqueue(&SctpTransport::flush, this);
 }
 
 void SctpTransport::incoming(message_ptr message) {