discovery: add missing offline peer check before sending message reliably
This commit is contained in:
parent
3e81e89062
commit
3a2c4ec594
@ -225,6 +225,14 @@ out:
|
|||||||
// can only contain messages which have a ShortChannelID field.
|
// can only contain messages which have a ShortChannelID field.
|
||||||
shortChanID, _ := msgShortChanID(msg)
|
shortChanID, _ := msgShortChanID(msg)
|
||||||
|
|
||||||
|
// Ensure the peer is still online right before sending the
|
||||||
|
// message.
|
||||||
|
select {
|
||||||
|
case <-offlineChan:
|
||||||
|
goto waitUntilOnline
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
if err := peer.SendMessage(false, msg); err != nil {
|
if err := peer.SendMessage(false, msg); err != nil {
|
||||||
log.Errorf("Unable to send %v message for channel=%v "+
|
log.Errorf("Unable to send %v message for channel=%v "+
|
||||||
"to %x: %v", msg.MsgType(), shortChanID,
|
"to %x: %v", msg.MsgType(), shortChanID,
|
||||||
|
Loading…
Reference in New Issue
Block a user