mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 14:57:38 +02:00
discovery/syncer: make gossip sends synchronous
This commit makes all replies in the gossip syncer synchronous, meaning that they will wait for each message to be successfully written to the remote peer before attempting to send the next. This helps throttle messages the remote peer has requested, preventing unintended disconnects when the remote peer is slow to process messages. This changes also helps out congestion in the peer by forcing the syncer to buffer the messages instead of dumping them into the peer's queue.
This commit is contained in:
@@ -386,6 +386,9 @@ func (m *SyncManager) createGossipSyncer(peer lnpeer.Peer) *GossipSyncer {
|
||||
sendToPeer: func(msgs ...lnwire.Message) error {
|
||||
return peer.SendMessageLazy(false, msgs...)
|
||||
},
|
||||
sendToPeerSync: func(msgs ...lnwire.Message) error {
|
||||
return peer.SendMessageLazy(true, msgs...)
|
||||
},
|
||||
})
|
||||
|
||||
// Gossip syncers are initialized by default in a PassiveSync type
|
||||
|
Reference in New Issue
Block a user