瀏覽代碼

Enhanced SCTP send to flush before attempting to send

Paul-Louis Ageneau 4 年之前
父節點
當前提交
e34a3bb8ae
共有 1 個文件被更改,包括 3 次插入3 次删除
  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);