peer: add FIXME for the STATE_INIT case.

We store peers in the database for STATE_INIT, but they don't reconnect
properly.  We should not forget STATE_INIT dropped peers, but use some
timeout mechanism if we can't reconnect to clean up.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-10-07 14:00:17 +10:30
parent fb99e0ccb0
commit ab569c069f

View File

@ -2056,6 +2056,8 @@ static struct io_plan *peer_crypto_on(struct io_conn *conn, struct peer *peer)
assert(peer->state == STATE_INIT);
/* FIXME: Delay db write until we have something to keep, or handle
* reconnect with STATE_INIT state. */
if (!db_create_peer(peer))
fatal("Database error in %s", __func__);
@ -2087,6 +2089,8 @@ static void peer_disconnect(struct io_conn *conn, struct peer *peer)
/* Not even set up yet? Simply free.*/
if (peer->state == STATE_INIT) {
/* FIXME: Make reconnect work for STATE_INIT, but
* cleanup if we don't reconnect after some duration. */
db_forget_peer(peer);
tal_free(peer);
return;