Commit 686a586
committed
Correct
When we forward gossip messages, we use the already-encoded copy
we have, pushing it onto the `gossip_broadcast_buffer`. When we
have free socket buffer space, and there are no non-gossip messages
pending, we'll remove it from the `gossip_broadcast_buffer` and
push it onto the normal `pending_outbound_buffer` socket queue.
Separately, we use `msgs_sent_since_pong` to ensure that our peer
is being responsive and our messages are getting through with
minimal latency. After we send 32 messages (if we've already
received the `pong` for the last `ping` wensent), we send an extra
`ping` and will only queue up an additional 32 forwarded gossip
messages before we start dropping forwarded gossip on the floor.
Previously, we (arguably) incorrectly incremented
`msgs_sent_since_pong` when we pushed a message onto the
`gossip_broadcast_buffer`, not when it was actually queued up in
our `pending_outbound_buffer` immediate socket queue. This is
fairly strange - the point of `msgs_sent_since_pong` is to keep
peer latency low, we already independently enforce memory limits to
ensure we drop forwarded gossip messages if a peer's message queues
have grown too large. This means we potentially disconnect a peer
for not draining the backlog forwarded-gossip socket queue fast
enough, rather than simply dropping gossip.
While this shouldn't be a big deal in practice, I do see (mostly
Tor) peers disconnect on my node occasionally, and while its likely
due to Tor circuits hanging and a disconnect is needed, the
incorrect tracking here makes state analysis difficult as there are
nearly always a flow of enough gossip messages to "send to the
peer". Its also possible that this allows incredibly low bandwidth
connections to stay afloat more durably.msgs_sent_since_pong tracking for gossip forwards1 parent 50391d3 commit 686a586
1 file changed
+7
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1551 | 1551 | | |
1552 | 1552 | | |
1553 | 1553 | | |
| 1554 | + | |
1554 | 1555 | | |
1555 | 1556 | | |
1556 | 1557 | | |
| |||
1714 | 1715 | | |
1715 | 1716 | | |
1716 | 1717 | | |
1717 | | - | |
1718 | | - | |
1719 | | - | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
1723 | 1718 | | |
1724 | 1719 | | |
1725 | 1720 | | |
| |||
2689 | 2684 | | |
2690 | 2685 | | |
2691 | 2686 | | |
2692 | | - | |
2693 | | - | |
2694 | | - | |
2695 | | - | |
| 2687 | + | |
| 2688 | + | |
2696 | 2689 | | |
2697 | 2690 | | |
2698 | 2691 | | |
| |||
2733 | 2726 | | |
2734 | 2727 | | |
2735 | 2728 | | |
2736 | | - | |
2737 | | - | |
2738 | | - | |
2739 | | - | |
| 2729 | + | |
| 2730 | + | |
2740 | 2731 | | |
2741 | 2732 | | |
2742 | 2733 | | |
| |||
2772 | 2763 | | |
2773 | 2764 | | |
2774 | 2765 | | |
2775 | | - | |
2776 | | - | |
2777 | | - | |
2778 | | - | |
| 2766 | + | |
| 2767 | + | |
2779 | 2768 | | |
2780 | 2769 | | |
2781 | 2770 | | |
| |||
0 commit comments