Skip to content

Commit 0d7bf21

Browse files
committed
connectd: don't received useless peer fd if we're told to send final msg.
We don't need the connection to ourselves! Signed-off-by: Rusty Russell <[email protected]>
1 parent cf34f59 commit 0d7bf21

File tree

6 files changed

+3
-20
lines changed

6 files changed

+3
-20
lines changed

connectd/connectd.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,21 +1817,10 @@ static void peer_final_msg(struct io_conn *conn,
18171817
struct peer *peer;
18181818
struct node_id id;
18191819
u8 *finalmsg;
1820-
int peer_fd;
18211820

18221821
if (!fromwire_connectd_peer_final_msg(tmpctx, msg, &id, &finalmsg))
18231822
master_badmsg(WIRE_CONNECTD_PEER_FINAL_MSG, msg);
18241823

1825-
/* Get the peer_fd for this peer: we don't need it though! */
1826-
io_fd_block(io_conn_fd(conn), true);
1827-
peer_fd = fdpass_recv(io_conn_fd(conn));
1828-
if (peer_fd == -1)
1829-
status_failed(STATUS_FAIL_MASTER_IO,
1830-
"Getting peer fd after peer_final_msg: %s",
1831-
strerror(errno));
1832-
close(peer_fd);
1833-
io_fd_block(io_conn_fd(conn), false);
1834-
18351824
/* This can happen if peer hung up on us. */
18361825
peer = peer_htable_get(&daemon->peers, &id);
18371826
if (peer) {

connectd/connectd_wire.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ msgdata,connectd_peer_connected,features,u8,flen
7272
msgtype,connectd_peer_disconnected,2015
7373
msgdata,connectd_peer_disconnected,id,node_id,
7474

75-
# master -> connectd: give message to peer and disconnect. Plus fd for peer
75+
# master -> connectd: give message to peer and disconnect.
7676
msgtype,connectd_peer_final_msg,2003
7777
msgdata,connectd_peer_final_msg,id,node_id,
7878
msgdata,connectd_peer_final_msg,len,u16,

lightningd/opening_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void handle_reestablish(struct lightningd *ld,
194194
subd_send_msg(ld->connectd,
195195
take(towire_connectd_peer_final_msg(NULL, peer_id,
196196
err)));
197-
subd_send_fd(ld->connectd, peer_fd);
197+
close(peer_fd);
198198
}
199199
}
200200

lightningd/peer_control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,7 +1057,7 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa
10571057
subd_send_msg(ld->connectd,
10581058
take(towire_connectd_peer_final_msg(NULL, &peer->id,
10591059
error)));
1060-
subd_send_fd(ld->connectd, payload->peer_fd);
1060+
close(payload->peer_fd);
10611061
}
10621062

10631063
static bool

lightningd/test/run-invoice-select-inchan.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,6 @@ void subd_req_(const tal_t *ctx UNNEEDED,
599599
void (*replycb)(struct subd * UNNEEDED, const u8 * UNNEEDED, const int * UNNEEDED, void *) UNNEEDED,
600600
void *replycb_data UNNEEDED)
601601
{ fprintf(stderr, "subd_req_ called!\n"); abort(); }
602-
/* Generated stub for subd_send_fd */
603-
void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED)
604-
{ fprintf(stderr, "subd_send_fd called!\n"); abort(); }
605602
/* Generated stub for subd_send_msg */
606603
void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED)
607604
{ fprintf(stderr, "subd_send_msg called!\n"); abort(); }

wallet/test/run-wallet.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,6 @@ void subd_req_(const tal_t *ctx UNNEEDED,
638638
void (*replycb)(struct subd * UNNEEDED, const u8 * UNNEEDED, const int * UNNEEDED, void *) UNNEEDED,
639639
void *replycb_data UNNEEDED)
640640
{ fprintf(stderr, "subd_req_ called!\n"); abort(); }
641-
/* Generated stub for subd_send_fd */
642-
void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED)
643-
{ fprintf(stderr, "subd_send_fd called!\n"); abort(); }
644641
/* Generated stub for subd_send_msg */
645642
void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED)
646643
{ fprintf(stderr, "subd_send_msg called!\n"); abort(); }

0 commit comments

Comments
 (0)