mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
network: speculatively set GetAddrSent status
Otherwise we routinely get "unexpected addr received" error.
This commit is contained in:
parent
e80c60a3b9
commit
8b26d9475b
1 changed files with 3 additions and 3 deletions
|
@ -1367,11 +1367,11 @@ func (s *Server) iteratePeersWithSendMsg(msg *Message, send func(Peer, context.C
|
|||
var ctx, cancel = context.WithTimeout(context.Background(), s.TimePerBlock/2)
|
||||
for _, peer := range peers {
|
||||
go func(p Peer, ctx context.Context, pkt []byte) {
|
||||
err := send(p, ctx, pkt)
|
||||
if err == nil && msg.Command == CMDGetAddr {
|
||||
// Do this before packet is sent, reader thread can get the reply before this routine wakes up.
|
||||
if msg.Command == CMDGetAddr {
|
||||
p.AddGetAddrSent()
|
||||
}
|
||||
replies <- err
|
||||
replies <- send(p, ctx, pkt)
|
||||
}(peer, ctx, pkt)
|
||||
}
|
||||
for r := range replies {
|
||||
|
|
Loading…
Reference in a new issue