server: make sendToPeer async

This commit removes another case of unnecessary blockage, by modifying
the sendToPeer method to be fully asynchronous. From the PoV of the
callers that utilize this method currently, there’s no reason to block
until the completion of this method. Additionally, as the graph grows
larger without more intelligent the number of messages sent during
initial dump will start to be prohibitive to waiting for full
completion before proceeding.
This commit is contained in:
Olaoluwa Osuntokun 2017-10-14 17:06:23 -07:00
parent 6db90ef09a
commit b7704e2de3
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -908,7 +908,7 @@ func (s *server) sendToPeer(target *btcec.PublicKey, msgs []lnwire.Message) erro
return err
}
s.sendPeerMessages(targetPeer, msgs)
go s.sendPeerMessages(targetPeer, msgs)
return nil
}