Skip to content

Commit 3f32877

Browse files
committed
Fix bogus reentrancy from read_event -> do_attempt_write_data
`Julian Knutsen <[email protected]>` pointed out in a previous discussion that `read_event` can reenter user code despite the documentation stating explicitly that it will not. This was addressed in lightningdevkit#456 by simply codifying the reentrancy, but its somewhat simpler to just drop the `do_attempt_write_data` call. Ideally we could land most of Julian's work, but its still in need of substantial git history cleanup to get it in a reviewable state and this solves the immediate issue.
1 parent 5bf4cad commit 3f32877

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref> PeerManager<D
794794
}
795795
};
796796

797-
if let Err(handling_error) = self.handle_message(&mut peers.peers_needing_send, peer, peer_descriptor.clone(), message){
797+
if let Err(handling_error) = self.handle_message(&mut peers.peers_needing_send, peer, peer_descriptor.clone(), message) {
798798
match handling_error {
799799
MessageHandlingError::PeerHandleError(e) => { return Err(e) },
800800
MessageHandlingError::LightningError(e) => {
@@ -808,8 +808,6 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, L: Deref> PeerManager<D
808808
}
809809
}
810810

811-
self.do_attempt_write_data(peer_descriptor, peer);
812-
813811
peer.pending_outbound_buffer.len() > 10 // pause_read
814812
}
815813
};

0 commit comments

Comments
 (0)