mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-09 20:49:08 +02:00
Merge pull request #8158 from Crypt-iQ/writeMessage_fix
peer: send messages in Start via writeMessage to bypass writeHandler
This commit is contained in:
commit
6de3fea8e6
@ -19,6 +19,8 @@
|
||||
|
||||
# Bug Fixes
|
||||
|
||||
* A bug that caused certain API calls to hang [has been fixed](https://github.com/lightningnetwork/lnd/pull/8158).
|
||||
|
||||
* [LND now sets the `BADONION`](https://github.com/lightningnetwork/lnd/pull/7937)
|
||||
bit when sending `update_fail_malformed_htlc`. This avoids a force close
|
||||
with other implementations.
|
||||
|
@ -722,9 +722,15 @@ func (p *Brontide) Start() error {
|
||||
if len(msgs) > 0 {
|
||||
p.log.Infof("Sending %d channel sync messages to peer after "+
|
||||
"loading active channels", len(msgs))
|
||||
if err := p.SendMessage(true, msgs...); err != nil {
|
||||
p.log.Warnf("Failed sending channel sync "+
|
||||
"messages to peer: %v", err)
|
||||
|
||||
// Send the messages directly via writeMessage and bypass the
|
||||
// writeHandler goroutine to avoid cases where writeHandler
|
||||
// may exit and cause a deadlock.
|
||||
for _, msg := range msgs {
|
||||
if err := p.writeMessage(msg); err != nil {
|
||||
return fmt.Errorf("unable to send reestablish"+
|
||||
"msg: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2088,11 +2094,6 @@ func (p *Brontide) logWireMessage(msg lnwire.Message, read bool) {
|
||||
// with a nil message iff a timeout error is returned. This will continue to
|
||||
// flush the pending message to the wire.
|
||||
func (p *Brontide) writeMessage(msg lnwire.Message) error {
|
||||
// Simply exit if we're shutting down.
|
||||
if atomic.LoadInt32(&p.disconnect) != 0 {
|
||||
return lnpeer.ErrPeerExiting
|
||||
}
|
||||
|
||||
// Only log the message on the first attempt.
|
||||
if msg != nil {
|
||||
p.logWireMessage(msg, false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user