network: don't wait indefinitely for packet to be sent
Peers can be slow, very slow, slow enough to affect node's regular operation. We can't wait for them indefinitely, there has to be a timeout for send operations. This patch uses TimePerBlock as a reference for its timeout. It's relatively big and it doesn't affect tests much, 4+1 scenarios tend to perform a little worse with while 7+2 scenarios work a little better. The difference is in some percents, but all of these tests easily have 10-15% variations from run to run. It's an important step in making our gossip better because we can't have any behavior where neighbors directly block the node forever, refs. #2678 and
This commit is contained in:
parent
478b4b0c1c
commit
dabdad20ad
2 changed files with 10 additions and 3 deletions
|
@ -1385,7 +1385,7 @@ func (s *Server) iteratePeersWithSendMsg(msg *Message, send func(Peer, bool, []b
|
|||
peer.AddGetAddrSent()
|
||||
}
|
||||
sentN++
|
||||
} else if errors.Is(err, errBusy) {
|
||||
} else if !blocking && errors.Is(err, errBusy) {
|
||||
// Can be retried.
|
||||
continue
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue