Răsfoiți Sursa

Enhanced SCTP send to flush before attempting to send

Paul-Louis Ageneau 4 ani în urmă
părinte
comite
e34a3bb8ae
1 a modificat fișierele cu 3 adăugiri și 3 ștergeri
  1. 3 3
      src/sctptransport.cpp

+ 3 - 3
src/sctptransport.cpp

@@ -283,12 +283,12 @@ bool SctpTransport::send(message_ptr message) {
 	std::lock_guard lock(mSendMutex);
 
 	if (!message)
-		return mSendQueue.empty();
+		return trySendQueue();
 
 	PLOG_VERBOSE << "Send size=" << message->size();
 
-	// If nothing is pending, try to send directly
-	if (mSendQueue.empty() && trySendMessage(message))
+	// Flush the queue, and if nothing is pending, try to send directly
+	if (trySendQueue() && trySendMessage(message))
 		return true;
 
 	mSendQueue.push(message);