dev_disconnect: support multiple disconnects in the same daemon.

We currently assume the daemon gives up; gossipd won't, and we want to
test it there too.

This reveals a bug (returning io_close() is bad if the call is to
duplex()), and breaks a test which now continues after dropping a
packet..

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-10-11 20:39:49 +10:30
committed by Christian Decker
parent 6ceec17943
commit 2273ce783e
3 changed files with 21 additions and 9 deletions

View File

@@ -346,7 +346,8 @@ struct io_plan *peer_write_message(struct io_conn *conn,
switch (dev_disconnect(type)) {
case DEV_DISCONNECT_BEFORE:
return io_close(conn);
dev_sabotage_fd(io_conn_fd(conn));
break;
case DEV_DISCONNECT_DROPPKT:
pcs->out = NULL; /* FALL THRU */
case DEV_DISCONNECT_AFTER: