mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
connectd: don't received useless peer fd if we're told to send final msg.
We don't need the connection to ourselves, just to free it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ca08f27d54
commit
727b486d49
6 changed files with 3 additions and 24 deletions
|
@ -1846,21 +1846,10 @@ static void peer_final_msg(struct io_conn *conn,
|
|||
struct peer *peer;
|
||||
struct node_id id;
|
||||
u8 *finalmsg;
|
||||
int peer_fd;
|
||||
|
||||
if (!fromwire_connectd_peer_final_msg(tmpctx, msg, &id, &finalmsg))
|
||||
master_badmsg(WIRE_CONNECTD_PEER_FINAL_MSG, msg);
|
||||
|
||||
/* Get the peer_fd for this peer: we don't need it though! */
|
||||
io_fd_block(io_conn_fd(conn), true);
|
||||
peer_fd = fdpass_recv(io_conn_fd(conn));
|
||||
if (peer_fd == -1)
|
||||
status_failed(STATUS_FAIL_MASTER_IO,
|
||||
"Getting peer fd after peer_final_msg: %s",
|
||||
strerror(errno));
|
||||
close(peer_fd);
|
||||
io_fd_block(io_conn_fd(conn), false);
|
||||
|
||||
/* This can happen if peer hung up on us. */
|
||||
peer = peer_htable_get(&daemon->peers, &id);
|
||||
if (peer) {
|
||||
|
|
|
@ -72,7 +72,7 @@ msgdata,connectd_peer_connected,features,u8,flen
|
|||
msgtype,connectd_peer_disconnected,2015
|
||||
msgdata,connectd_peer_disconnected,id,node_id,
|
||||
|
||||
# master -> connectd: give message to peer and disconnect. Plus fd for peer
|
||||
# master -> connectd: give message to peer and disconnect.
|
||||
msgtype,connectd_peer_final_msg,2003
|
||||
msgdata,connectd_peer_final_msg,id,node_id,
|
||||
msgdata,connectd_peer_final_msg,len,u16,
|
||||
|
|
|
|
@ -194,9 +194,7 @@ void handle_reestablish(struct lightningd *ld,
|
|||
subd_send_msg(ld->connectd,
|
||||
take(towire_connectd_peer_final_msg(NULL, peer_id,
|
||||
err)));
|
||||
subd_send_fd(ld->connectd, peer_fd->fd);
|
||||
/* Don't close this fd! */
|
||||
peer_fd->fd = -1;
|
||||
tal_free(peer_fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1053,9 +1053,7 @@ send_error:
|
|||
subd_send_msg(ld->connectd,
|
||||
take(towire_connectd_peer_final_msg(NULL, &peer->id,
|
||||
error)));
|
||||
subd_send_fd(ld->connectd, payload->peer_fd->fd);
|
||||
/* Don't close the fd! */
|
||||
payload->peer_fd->fd = -1;
|
||||
tal_free(payload->peer_fd);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
@ -603,9 +603,6 @@ void subd_req_(const tal_t *ctx UNNEEDED,
|
|||
void (*replycb)(struct subd * UNNEEDED, const u8 * UNNEEDED, const int * UNNEEDED, void *) UNNEEDED,
|
||||
void *replycb_data UNNEEDED)
|
||||
{ fprintf(stderr, "subd_req_ called!\n"); abort(); }
|
||||
/* Generated stub for subd_send_fd */
|
||||
void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED)
|
||||
{ fprintf(stderr, "subd_send_fd called!\n"); abort(); }
|
||||
/* Generated stub for subd_send_msg */
|
||||
void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED)
|
||||
{ fprintf(stderr, "subd_send_msg called!\n"); abort(); }
|
||||
|
|
|
@ -642,9 +642,6 @@ void subd_req_(const tal_t *ctx UNNEEDED,
|
|||
void (*replycb)(struct subd * UNNEEDED, const u8 * UNNEEDED, const int * UNNEEDED, void *) UNNEEDED,
|
||||
void *replycb_data UNNEEDED)
|
||||
{ fprintf(stderr, "subd_req_ called!\n"); abort(); }
|
||||
/* Generated stub for subd_send_fd */
|
||||
void subd_send_fd(struct subd *sd UNNEEDED, int fd UNNEEDED)
|
||||
{ fprintf(stderr, "subd_send_fd called!\n"); abort(); }
|
||||
/* Generated stub for subd_send_msg */
|
||||
void subd_send_msg(struct subd *sd UNNEEDED, const u8 *msg_out UNNEEDED)
|
||||
{ fprintf(stderr, "subd_send_msg called!\n"); abort(); }
|
||||
|
|
Loading…
Add table
Reference in a new issue