mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-13 13:40:30 +08:00
fix(p2p): tcp sync: unlock of unlocked mutex
This commit is contained in:
@@ -459,7 +459,8 @@ func (conn *Conn) WriteToPeer(b []byte, ep p2p.EndPoint) (n int, err error) {
|
|||||||
if len(b) >= 65536 {
|
if len(b) >= 65536 {
|
||||||
return 0, errors.New("data size " + strconv.Itoa(len(b)) + " is too large")
|
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 {
|
if config.ShowDebugLog {
|
||||||
logrus.Debug("[tcp] try sub write to", tcpep)
|
logrus.Debug("[tcp] try sub write to", tcpep)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user