1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-20 02:27:32 +01:00

Ack unhandled lightning messages (#1042)

In the event when we receive an unexpected message, the `Peer` was just logging a warning and not sending an `Ack` to the `TransportHandler`. This resulted in a stuck connection, because no more data was read on the connection.

Fixes #1037.
This commit is contained in:
Pierre-Marie Padiou 2019-06-20 11:40:01 +02:00 committed by GitHub
parent 38696b56e4
commit 316ba02ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -191,6 +191,11 @@ class Peer(nodeParams: NodeParams, remoteNodeId: PublicKey, authenticator: Actor
d.transport ! PoisonPill
stay
case Event(unhandledMsg: LightningMessage, d: InitializingData) =>
// we ack unhandled messages because we don't want to block further reads on the connection
d.transport ! TransportHandler.ReadAck(unhandledMsg)
log.warning(s"acking unhandled message $unhandledMsg")
stay
}
when(CONNECTED) {
@ -458,6 +463,12 @@ class Peer(nodeParams: NodeParams, remoteNodeId: PublicKey, authenticator: Actor
d.channels.values.toSet[ActorRef].foreach(_ ! INPUT_DISCONNECTED) // we deduplicate with toSet because there might be two entries per channel (tmp id and final id)
self ! h
goto(DISCONNECTED) using DisconnectedData(d.address_opt, d.channels.collect { case (k: FinalChannelId, v) => (k, v) })
case Event(unhandledMsg: LightningMessage, d: ConnectedData) =>
// we ack unhandled messages because we don't want to block further reads on the connection
d.transport ! TransportHandler.ReadAck(unhandledMsg)
log.warning(s"acking unhandled message $unhandledMsg")
stay
}
whenUnhandled {