mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
common: handle peer input before gossipd input (for closingd, openingd)
Similar to the previous "handle peer input before gossip input", this fixes similar potential deadlock for closingd and openingd which use peer_or_gossip_sync_read. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
6e4d9acac3
commit
c9a907cd71
1 changed files with 9 additions and 9 deletions
|
@ -26,7 +26,12 @@ u8 *peer_or_gossip_sync_read(const tal_t *ctx,
|
|||
select(peer_fd > gossip_fd ? peer_fd + 1 : gossip_fd + 1,
|
||||
&readfds, NULL, NULL, NULL);
|
||||
|
||||
if (FD_ISSET(gossip_fd, &readfds)) {
|
||||
if (FD_ISSET(peer_fd, &readfds)) {
|
||||
msg = sync_crypto_read(ctx, cs, peer_fd);
|
||||
*from_gossipd = false;
|
||||
return msg;
|
||||
}
|
||||
|
||||
msg = wire_sync_read(ctx, gossip_fd);
|
||||
if (!msg)
|
||||
status_failed(STATUS_FAIL_GOSSIP_IO,
|
||||
|
@ -34,11 +39,6 @@ u8 *peer_or_gossip_sync_read(const tal_t *ctx,
|
|||
strerror(errno));
|
||||
*from_gossipd = true;
|
||||
return msg;
|
||||
}
|
||||
|
||||
msg = sync_crypto_read(ctx, cs, peer_fd);
|
||||
*from_gossipd = false;
|
||||
return msg;
|
||||
}
|
||||
|
||||
bool is_peer_error(const tal_t *ctx, const u8 *msg,
|
||||
|
|
Loading…
Add table
Reference in a new issue