Re: [Libguestfs] [nbdkit PATCH 2/4] server: Give client EOF when we are done writing

2022-10-31 Thread Richard W.M. Jones
On Mon, Oct 31, 2022 at 08:56:48AM -0500, Eric Blake wrote: > On Thu, Oct 27, 2022 at 09:49:52AM +0100, Richard W.M. Jones wrote: > > On Wed, Oct 26, 2022 at 05:18:00PM -0500, Eric Blake wrote: > > > - if (conn->sockin >= 0) > > > -closesocket (conn->sockin); > > > - if (conn->sockout >= 0

Re: [Libguestfs] [nbdkit PATCH 2/4] server: Give client EOF when we are done writing

2022-10-31 Thread Eric Blake
On Thu, Oct 27, 2022 at 09:49:52AM +0100, Richard W.M. Jones wrote: > On Wed, Oct 26, 2022 at 05:18:00PM -0500, Eric Blake wrote: > > - if (conn->sockin >= 0) > > -closesocket (conn->sockin); > > - if (conn->sockout >= 0 && conn->sockin != conn->sockout) > > -closesocket (conn->sockout);

Re: [Libguestfs] [nbdkit PATCH 2/4] server: Give client EOF when we are done writing

2022-10-27 Thread Richard W.M. Jones
On Wed, Oct 26, 2022 at 05:18:00PM -0500, Eric Blake wrote: > - if (conn->sockin >= 0) > -closesocket (conn->sockin); > - if (conn->sockout >= 0 && conn->sockin != conn->sockout) > -closesocket (conn->sockout); > + if (conn->sockout >= 0 && how == SHUT_WR) { > +if (conn->sockin ==

[Libguestfs] [nbdkit PATCH 2/4] server: Give client EOF when we are done writing

2022-10-26 Thread Eric Blake
If we detect a fatal error but do not close the socket back to the client, then we can create deadlock where we are stuck waiting to read NBD_CMD_DISC from the client but where the client is stuck waiting to read our reply. Try harder to explicitly inform the client any time that we have detected