Skip to content

Commit

Permalink
openingd: prioritize incoming peer traffic over handling (and sending…
Browse files Browse the repository at this point in the history
… out) gossip

- reduces probability for a deadlock where we block on sending data because
  the other peer cannot receive because it blocks on sending data etc.
- when either side sends so much data that it fills up the kernel/network buffer
- however sending out gossip can still block when (malicious) peer never receives
  • Loading branch information
SimonVrouwe authored and rustyrussell committed Sep 20, 2018
1 parent 674d176 commit 94e42f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openingd/openingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,10 +1157,11 @@ int main(int argc, char *argv[])
* don't try to service more than one fd per loop. */
if (pollfd[0].revents & POLLIN)
msg = handle_master_in(state);
else if (pollfd[1].revents & POLLIN)
handle_gossip_in(state);
else if (pollfd[2].revents & POLLIN)
msg = handle_peer_in(state);
else if (pollfd[1].revents & POLLIN)
handle_gossip_in(state);

clean_tmpctx();
}

Expand Down

0 comments on commit 94e42f2

Please sign in to comment.