flexnbd serve: Make the killswitch per-client-thread

This is a bit tricky, but calling shutdown() on a socket in a signal
handler is safe, and (at least in linux) appears to cause any read()
or write() calls blocked on that socket to return, even with SA_RESTART.

I'm not confident enough about the rest of flexnbd's syscall error
handling to turn SA_RESTART off for this signal...
This commit is contained in:
nick
2014-01-22 11:49:21 +00:00
parent 905d66af77
commit 91d9531a60
5 changed files with 88 additions and 48 deletions

View File

@@ -5,6 +5,7 @@
#include "mirror.h"
#include "serve.h"
#include "proxy.h"
#include "client.h"
#include "self_pipe.h"
#include "mbox.h"
#include "control.h"