Browse Source

ccan/io: remove IO_IDLE state.

Use a NULL io pointer instead to indicate an idle connection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 12 years ago
parent
commit
a5af4b1701
2 changed files with 3 additions and 3 deletions
  1. 3 2
      ccan/io/io.c
  2. 0 1
      ccan/io/io.h

+ 3 - 2
ccan/io/io.c

@@ -230,7 +230,8 @@ struct io_plan io_idle(void)
 	struct io_plan plan;
 	struct io_plan plan;
 
 
 	plan.pollflag = 0;
 	plan.pollflag = 0;
-	plan.state = IO_IDLE;
+	plan.state = IO_IO;
+	plan.io = NULL;
 
 
 	return plan;
 	return plan;
 }
 }
@@ -241,7 +242,7 @@ void io_wake(struct io_conn *conn, struct io_plan plan)
 	/* It might have finished, but we haven't called its finish() yet. */
 	/* It might have finished, but we haven't called its finish() yet. */
 	if (conn->plan.state == IO_FINISHED)
 	if (conn->plan.state == IO_FINISHED)
 		return;
 		return;
-	assert(conn->plan.state == IO_IDLE);
+	assert(!conn->plan.io);
 	conn->plan = plan;
 	conn->plan = plan;
 	backend_wakeup(conn);
 	backend_wakeup(conn);
 }
 }

+ 0 - 1
ccan/io/io.h

@@ -36,7 +36,6 @@ enum io_result {
 
 
 enum io_state {
 enum io_state {
 	IO_IO,
 	IO_IO,
-	IO_IDLE,
 	IO_FINISHED
 	IO_FINISHED
 };
 };