From af86015d724e5edf001aa024fe7d8581c45cffd9 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期四, 15 四月 2021 10:44:12 +0800
Subject: [PATCH] fix sendq lock, use different mutexes for in,out.

---
 src/sendq.h |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/sendq.h b/src/sendq.h
index 7cd8b13..b4f3821 100644
--- a/src/sendq.h
+++ b/src/sendq.h
@@ -68,7 +68,7 @@
 
 		msg.AddRef();
 		TimedMsg tmp(expire, MsgInfo{msg, onExpire});
-		std::unique_lock<std::mutex> lock(mutex_);
+		std::unique_lock<std::mutex> lock(mutex_in_);
 		auto &al = in_[addr];
 		if (!al.empty()) {
 			al.front().emplace_back(std::move(tmp));
@@ -95,7 +95,8 @@
 		MsgI &operator*() { return iter_->data().msg_; }
 	};
 
-	std::mutex mutex_;
+	std::mutex mutex_in_;
+	std::mutex mutex_out_;
 	Store in_;
 	Store out_;
 };

--
Gitblit v1.8.0