On Haiku tests/test-socket-activation failed with:
nbdkit: locks.c:96:lock_request: conn != NULL
called from server/sockets.c: accept_connection
in the fallback path which does:
lock_request ();
thread_data->sock = set_cloexec (accept (listen_sock, NULL, NULL));
unlock_request ()
Because there is no current connection in this thread this code fails.
However it should be possible to call lock_request without a
connection, provided that
thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS (which it is
when the fallback path is engaged on Haiku). There was a regression
caused when I modified to code to use an implicit TLS connection.
Fixes commit 91023f269d4cea56f573a1aa0d880b12052f6e1e.
---
server/locks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/locks.c b/server/locks.c
index 5d54d311..9269c75e 100644
--- a/server/locks.c
+++ b/server/locks.c
@@ -93,7 +93,7 @@ unlock_connection (void)
void
lock_request (void)
{
- GET_CONN;
+ struct connection *conn = threadlocal_get_conn ();
if (thread_model <= NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS &&
pthread_mutex_lock (&all_requests_lock))
@@ -110,7 +110,7 @@ lock_request (void)
void
unlock_request ()
{
- GET_CONN;
+ struct connection *conn = threadlocal_get_conn ();
if (pthread_rwlock_unlock (&unload_prevention_lock))
abort ();
--
2.25.0