peer: free init packet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-11-04 11:17:04 +10:30
parent 6bda93f99a
commit 8a1559a343
2 changed files with 5 additions and 0 deletions

View File

@ -255,6 +255,8 @@ static struct io_plan *recv_body(struct io_conn *conn, struct peer *peer)
{
struct io_data *iod = peer->io_data;
assert(!peer->inpkt);
/* We have full packet. */
peer->inpkt = decrypt_body(iod, iod, peer->log);
if (!peer->inpkt)

View File

@ -2145,6 +2145,8 @@ static struct io_plan *init_pkt_in(struct io_conn *conn, struct peer *peer)
}
/* Back into normal mode. */
peer->inpkt = tal_free(peer->inpkt);
peer_has_connected(peer);
return io_duplex(conn,
peer_read_packet(conn, peer, pkt_in),
@ -2432,6 +2434,7 @@ struct peer *new_peer(struct lightningd_state *dstate,
peer->io_data = NULL;
peer->secrets = NULL;
list_head_init(&peer->watches);
peer->inpkt = NULL;
peer->outpkt = tal_arr(peer, Pkt *, 0);
peer->open_jsoncmd = NULL;
peer->commit_jsoncmd = NULL;