]> git.ozlabs.org Git - ccan/commit
ccan/io: fix occasional immediate close after io_shutdown()
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 29 Sep 2025 01:37:01 +0000 (11:07 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 29 Sep 2025 01:37:01 +0000 (11:07 +0930)
commita67496f2d1f467f473cb39d56525e2d73b0d1b1d
treec71df9fa20171bec204022b221e3047719503fff
parente43c61c4c760aed7fd4ab6b716b019fc170f280d
ccan/io: fix occasional immediate close after io_shutdown()

If we're doing a duplex connection, we could be still trying to write:
that will fail (since we called shutdown on the write side), and we'll
respond by closing the socket.

The reason we're doing shutdown() is to ensure the final bytes are
written: doing a close() breaks this, and so the result is lost final
bytes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/io.c