lnd/peer
Eugene Siegel 955a345153
peer: send messages in Start via writeMessage to bypass writeHandler
Without this the following could happen:

* InboundPeerConnected is called while we already have an inbound
connection with the peer. This calls removePeer which calls Disconnect.
* If the peer is starting up in Start, it may be sending messages
synchronously via SendMessage(true, ...). This eventually calls the
writeMessage function which will exit if disconnect is set to 1.
* Since Disconnect was called, disconnect will be 1 and writeMessage
will exit, causing writeHandler to exit.
* If there is more than 1 message being sent, later messages will
queue in queueHandler but be unable to get into sendQueue as the
writeHandler goroutine has exited.
* The synchronous sends will be waiting on the errChan indefinitely
and startReady will never get closed meaning Disconnect will never
proceed.

The end result is that the server's mutex will be held until shutdown.

Avoid this by using writeMessage to bypass the writeHandler goroutine.
2023-11-08 16:36:02 -05:00
..
brontide_test.go peer: fix unit test flake 2023-10-13 13:50:07 +08:00
brontide.go peer: send messages in Start via writeMessage to bypass writeHandler 2023-11-08 16:36:02 -05:00
interfaces.go htlcswitch+peer: CreateAndAddLink in switch, add messageSwitch to peer 2021-08-10 17:15:52 -04:00
log.go multi: remove peer.go, change all references to point to peer pkg 2020-07-06 19:16:07 -04:00
musig_chan_closer.go lnwallet: fix taproot co-op close nonce bug 2023-08-22 16:33:50 -07:00
ping_manager_test.go peer: Add machinery to track the state and validity of remote pongs 2023-10-19 09:26:45 -07:00
ping_manager.go peer: Add machinery to track the state and validity of remote pongs 2023-10-19 09:26:45 -07:00
test_utils.go input+wallet: extract musig2 session management into new module 2023-08-22 16:30:39 -07:00