Skip to content

Commit

Permalink
feat(p2p): add tcp fast fail except
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Aug 7, 2024
1 parent aa6f5ee commit d577ae2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gold/p2p/tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ 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 && !conn.cplk.TryLock() {
if (!conn.suberr || len(conn.subs) > 0) && !conn.cplk.TryLock() {
logrus.Infoln("[tcp] try sub write")
n, err = conn.writeToPeer(b, tcpep, true) // try sub write
if err == nil {
Expand Down

0 comments on commit d577ae2

Please sign in to comment.