io: fix nasty io_wake corner case.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 31 May 2017 03:05:45 +0000 (12:35 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 May 2017 03:05:45 +0000 (12:35 +0930)
commitd00c9d1be5a56fbf990882f9a6da5704b3f1ea75
tree5391229d6bd330b1297cd46753486ec322d2f1ea
parent7e7a53d5ab61be8ef2387c030b18fea209676917
io: fix nasty io_wake corner case.

If we're duplex and one io_always callback makes the other io_always,
we screwed up and hit an assertion later when the conn was in the
always list but didn't actually want to be.

io_wake() uses io_always(), so this is how it happened.  Writing a
test case for this was a bit fun, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/io.c
ccan/io/test/run-40-wakeup-mutual.c [new file with mode: 0644]