Wouter, On 5 Feb 2013, at 21:37, Wouter Verhelst wrote:
>> #1 Set the default action of SIGPIPE to Ign. >> >> This is simplest to do, but not the right thing in my opinion. > > It feels utterly wrong to me. If the client isn't talking to us anymore, > we need to stop, not try to continue. Doing otherwise could cause > different issues down the road; I don't want to go there. Why do you think ignoring SIGPIPE is wrong? Provided you catch the condition in your select loop, you can tell when the client is not talking to you any more. I haven't got my copy of Stephens in front of me, but I am pretty sure it's the way he recommends doing things where there is more than one non-blocking fd open, or you have anything else that might cause a SIGPIPE. And if we are not catching this sort of thing in our select loop, that seems to me exactly the sort of thing that causes other problems. What I mean by this is that SIGPIPE is always generated on a write to a pipe (or socket) with no readers. In general nbd is waiting to read, rather than to write. So we need to reliably catch the case of a client disconnecting when we are trying to read anyway. Writes to an fd which has already generated an ignored SIGPIPE will always error, and we need to cope with write errors anyway (SIGPIPE or no SIGPIPE). -- Alex Bligh ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Nbd-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nbd-general
