From b7704e2de3dc96a4aebc2f47908a8f9def1da7f6 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 14 Oct 2017 17:06:23 -0700 Subject: [PATCH] server: make sendToPeer async MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index 8e2f3ec0a..ef76f35e7 100644 --- a/server.go +++ b/server.go @@ -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 }