server: Add threadlocal_get_conn
commit86fdb48c6a5362d66865493d9d2172166f99722e
authorEric Blake <eblake@redhat.com>
Thu, 1 Aug 2019 03:08:23 +0000 (31 22:08 -0500)
committerEric Blake <eblake@redhat.com>
Mon, 5 Aug 2019 14:09:03 +0000 (5 09:09 -0500)
tree4c9c18a5db6c25c413eda096f103353d28cd4ad8
parent9788a44996dad1beac57f49036cc8beac05a17b3
server: Add threadlocal_get_conn

We'd like to interrupt a sleep during a filter/plugin transaction if
it is obvious that finishing the transaction is pointless (because the
client has delivered NBD_CMD_DISC or hit EOF).  But to do that, we
need to get back at the connection object from a function called from
the plugin thread.  Passing the connection as an opaque object would
be a major API change, so it's easier to just add a thread-local
tracking the current connection.

Signed-off-by: Eric Blake <eblake@redhat.com>
server/connections.c
server/internal.h
server/threadlocal.c