mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
channeld: prioritize read from peer over (read from gossipd and) write to peer
This solves (or at least reduces probability of) a deadlock in channeld when there is lot of gossip traffic, see issue #2286. That issue is almost identical to #1943 (deadlock in openingd) and so is the fix.
This commit is contained in:
parent
10057c8335
commit
6e4d9acac3
1 changed files with 4 additions and 4 deletions
|
@ -2928,6 +2928,10 @@ int main(int argc, char *argv[])
|
|||
"Can't read command: %s",
|
||||
strerror(errno));
|
||||
req_in(peer, msg);
|
||||
} else if (FD_ISSET(PEER_FD, &rfds)) {
|
||||
/* This could take forever, but who cares? */
|
||||
msg = sync_crypto_read(tmpctx, &peer->cs, PEER_FD);
|
||||
peer_in(peer, msg);
|
||||
} else if (FD_ISSET(GOSSIP_FD, &rfds)) {
|
||||
msg = wire_sync_read(tmpctx, GOSSIP_FD);
|
||||
/* Gossipd hangs up on us to kill us when a new
|
||||
|
@ -2935,10 +2939,6 @@ int main(int argc, char *argv[])
|
|||
if (!msg)
|
||||
peer_failed_connection_lost();
|
||||
handle_gossip_msg(PEER_FD, &peer->cs, take(msg));
|
||||
} else if (FD_ISSET(PEER_FD, &rfds)) {
|
||||
/* This could take forever, but who cares? */
|
||||
msg = sync_crypto_read(tmpctx, &peer->cs, PEER_FD);
|
||||
peer_in(peer, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue