Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
rustyrussell committed Jan 10, 2022
1 parent 3a66610 commit a62dd06
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion connectd/connectd.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,13 @@ struct io_plan *peer_connected(struct io_conn *conn,
int subd_fd, gossip_fd;

peer = peer_htable_get(&daemon->peers, id);
if (peer)
if (peer) {
status_peer_debug(id, "peer_reconnected:"
" told_to_close = %u, to_peer = %p, to_subd = %p",
peer->told_to_close, peer->to_peer, peer->to_subd);
return peer_reconnected(conn, daemon, id, addr, cs,
their_features, incoming);
}

/* We promised we'd take it by marking it TAKEN above; prepare to free it. */
if (taken(their_features))
Expand Down
13 changes: 13 additions & 0 deletions connectd/multiplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ static void destroy_subd_conn(struct io_conn *subd_conn, struct peer *peer)
* it hangs up! */
io_wake(&peer->peer_in);

status_peer_debug(&peer->id, "destroy_subd_conn:"
" told_to_close = %u, to_peer = %p, to_subd = %p",
peer->told_to_close, peer->to_peer, peer->to_subd);

/* If no peer, finally time to close */
if (!peer->to_peer && peer->told_to_close)
peer_conn_closed(peer);
Expand All @@ -602,10 +606,15 @@ void close_peer_conn(struct peer *peer)

/* Already dead? */
if (!peer->to_subd && !peer->to_peer) {
status_peer_debug(&peer->id, "close_peer_conn: already done");
peer_conn_closed(peer);
return;
}

status_peer_debug(&peer->id, "close_peer_conn:"
" told_to_close = %u, to_peer = %p, to_subd = %p",
peer->told_to_close, peer->to_peer, peer->to_subd);

/* In case it's not currently writing, wake write_to_peer */
msg_wake(peer->peer_outq);
}
Expand All @@ -630,6 +639,10 @@ static void destroy_peer_conn(struct io_conn *peer_conn, struct peer *peer)
assert(peer->to_peer == peer_conn);
peer->to_peer = NULL;

status_peer_debug(&peer->id, "destroy_peer_conn:"
" told_to_close = %u, to_peer = %p, to_subd = %p",
peer->told_to_close, peer->to_peer, peer->to_subd);

/* Flush internal connections if not already. */
if (peer->to_subd) {
msg_wake(peer->subd_outq);
Expand Down

0 comments on commit a62dd06

Please sign in to comment.