Skip to content

Commit 80a0d15

Browse files
authored
Merge pull request #521 from TheBlueMatt/2020-02-ping-connection-possible
Dont treat a timer tick as no_connection_possible
2 parents f328094 + de24150 commit 80a0d15

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,10 +755,13 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
755755

756756
// Unknown messages:
757757
wire::Message::Unknown(msg_type) if msg_type.is_even() => {
758+
log_debug!(self, "Received unknown even message of type {}, disconnecting peer!", msg_type);
758759
// Fail the channel if message is an even, unknown type as per BOLT #1.
759760
return Err(PeerHandleError{ no_connection_possible: true });
760761
},
761-
wire::Message::Unknown(_) => {},
762+
wire::Message::Unknown(msg_type) => {
763+
log_trace!(self, "Received unknown odd message of type {}, ignoring", msg_type);
764+
},
762765
}
763766
}
764767
}
@@ -1086,10 +1089,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref> PeerManager<Descriptor, CM> where
10861089
descriptors_needing_disconnect.push(descriptor.clone());
10871090
match peer.their_node_id {
10881091
Some(node_id) => {
1092+
log_trace!(self, "Disconnecting peer with id {} due to ping timeout", node_id);
10891093
node_id_to_descriptor.remove(&node_id);
1090-
self.message_handler.chan_handler.peer_disconnected(&node_id, true);
1094+
self.message_handler.chan_handler.peer_disconnected(&node_id, false);
10911095
}
1092-
None => {}
1096+
None => {
1097+
// This can't actually happen as we should have hit
1098+
// is_ready_for_encryption() previously on this same peer.
1099+
unreachable!();
1100+
},
10931101
}
10941102
return false;
10951103
}

0 commit comments

Comments
 (0)