Code

frontend: Force-close the connection in sdb_connection_close().
[sysdb.git] / src / frontend / connection.c
index b98987dd2e53b68ddf828e64c0bb67e61f01bba4..93829ab248dc3992eca7124b1c6a8f95bd035345 100644 (file)
@@ -439,6 +439,14 @@ sdb_connection_accept(int fd)
 void
 sdb_connection_close(sdb_conn_t *conn)
 {
+       if (! conn)
+               return;
+
+       /* close the connection even if someone else still references it */
+       if (conn->fd >= 0)
+               close(conn->fd);
+       conn->fd = -1;
+
        sdb_object_deref(SDB_OBJ(conn));
 } /* sdb_connection_close */