We want to do this as late as possible. In particular, backend_close
may call plugin.close which may (although it's unlikely) call one of
the functions which relies on the implicit connection pointer fetched
through thread-local storage (TLS) which would then fail.
---
server/connections.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/connections.c b/server/connections.c
index 66520fcb..9978afb4 100644
--- a/server/connections.c
+++ b/server/connections.c
@@ -331,7 +331,6 @@ free_connection (struct connection *conn)
if (!conn)
return;
- threadlocal_set_conn (NULL);
conn->close (conn);
if (listen_stdin) {
int fd;
@@ -368,6 +367,7 @@ free_connection (struct connection *conn)
free (conn->handles);
free (conn);
+ threadlocal_set_conn (NULL);
}
/* Write buffer to conn->sockout with send() and either succeed completely
--
2.25.0