-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handling unexpected msgs #841
Better handling unexpected msgs #841
Conversation
In particular, decode error messages correctly and do the right thing with messages about other channels. Signed-off-by: Rusty Russell <[email protected]>
In particular, handle pings. The rest is modelled on the channeld one, but annoyingly different enough that it's hard to share code without significant work. Signed-off-by: Rusty Russell <[email protected]>
In particular, this one didn't handle them trying to open a different channel at the same time. Again, deliberately very similar, but unfortunately different enough that sharing is awkward. Signed-off-by: Rusty Russell <[email protected]>
This makes much more sense when you ask for a specific peer's log. Also, we put the peerid rather than pid (). Signed-off-by: Rusty Russell <[email protected]>
@@ -80,6 +83,92 @@ static u64 one_towards(u64 target, u64 value) | |||
return value; | |||
} | |||
|
|||
static void handle_ping(const u8 *msg, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot we factor out this function to common/ping.c
? I dislike multiple functions with different contents having the same name. In addition, the handle_ping
in openingd and closingd look very very similar (possibly except for PEER_FD
but that can be passed in). Only the handle_ping
in channeld is different because it enqueues the pong
reply rather than sending it synchronously (but maybe sending it synchronously is acceptable to reduce code duplication...?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, as commit msg says, they're just similar enough to be annoying. I think trying to merge this is a future TODO.
Exception: Node /tmp/lightning-t5gxc6gs/test_closing_different_fees/lightning-2/ has memory leaks: [{'value': '0x55caa0a0b8d0', 'label': 'ccan/ccan/tal/str/str.c:90:char[]', 'backtrace': ['ccan/ccan/tal/tal.c:467 (tal_alloc_)', 'ccan/ccan/tal/tal.c:496 (tal_alloc_arr_)', 'ccan/ccan/tal/str/str.c:90 (tal_vfmt)', 'lightningd/log.c:131 (new_log)', 'lightningd/subd.c:632 (new_subd)', 'lightningd/subd.c:686 (new_peer_subd)', 'lightningd/peer_control.c:2487 (peer_accept_channel)', 'lightningd/peer_control.c:674 (peer_sent_nongossip)', 'lightningd/gossip_control.c:55 (peer_nongossip)', 'lightningd/gossip_control.c:142 (gossip_msg)', 'lightningd/subd.c:477 (sd_msg_read)', 'lightningd/subd.c:319 (read_fds)', 'ccan/ccan/io/io.c:59 (next_plan)', 'ccan/ccan/io/io.c:387 (do_plan)', 'ccan/ccan/io/io.c:397 (io_ready)', 'ccan/ccan/io/poll.c:305 (io_loop)', 'lightningd/lightningd.c:347 (main)', '(null):0 ((null))', '(null):0 ((null))', '(null):0 ((null))'], 'parents': ['lightningd/log.c:103:struct log_book', 'lightningd/lightningd.c:43:struct lightningd']}] Technically, true, but we save more memory by sharing the prefix pointer than we lose by leaking it. However, we'd ideally refcount so it's freed if the log is freed and all the entries using it are pruned from the log book. Signed-off-by: Rusty Russell <[email protected]>
Common handling style for messages in daemons, plus better per-peer logging.