1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-05 07:50:24 +08:00

fix(p2p): tcp sync: unlock of unlocked mutex

This commit is contained in:
源文雨
2025-02-21 00:56:15 +09:00
parent a52f9aa2c0
commit dbe990cac8

View File

@@ -459,7 +459,8 @@ func (conn *Conn) WriteToPeer(b []byte, ep p2p.EndPoint) (n int, err error) {
if len(b) >= 65536 {
return 0, errors.New("data size " + strconv.Itoa(len(b)) + " is too large")
}
if (!conn.suberr || len(conn.subs) > 0) && !conn.cplk.TryLock() {
locked := conn.cplk.TryLock()
if !locked && (!conn.suberr || len(conn.subs) > 0) {
if config.ShowDebugLog {
logrus.Debug("[tcp] try sub write to", tcpep)
}