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

@@ -58,6 +58,7 @@ struct client {
};
void client_killswitch_hit(int signal, siginfo_t *info, void *ptr);
void* client_serve(void* client_uncast);
struct client * client_create( struct server * serve, int socket );