summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 330d8bc)
raw | patch | inline | side by side (parent: 330d8bc)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 15 Dec 2014 08:18:43 +0000 (09:18 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Mon, 15 Dec 2014 08:18:43 +0000 (09:18 +0100) |
That'll allow for more flexible use.
src/frontend/connection.c | patch | blob | history | |
src/include/frontend/connection.h | patch | blob | history | |
t/unit/frontend/connection_test.c | patch | blob | history |
index ea2970f2f61f2f9faa1022b9457ce3e0c217a184..cf610ac45a06951a82c00644a943ef43d5da8ced 100644 (file)
if (conn->fd >= 0)
close(conn->fd);
conn->fd = -1;
-
- sdb_object_deref(SDB_OBJ(conn));
} /* sdb_connection_close */
ssize_t
index 20cc6c2b4b321d34a436be54c2459fa46d9df94e..906f906acbea436c5518dd84e798145a84b4d5ac 100644 (file)
extern "C" {
#endif
+/*
+ * sdb_conn_t represents an open connection from a client. It inherits from
+ * sdb_object_t and may safely be cast to a generic object.
+ */
typedef struct sdb_conn sdb_conn_t;
/*
/*
* sdb_connection_close:
- * Close a open connection and deallocate any memory. The connection object is
- * no longer valid after calling this function.
+ * Close an open connection. Any subsequent reads from the connection will
+ * fail. Use sdb_object_deref to free the memory used by the object.
*/
void
sdb_connection_close(sdb_conn_t *conn);
index de5b01007f4521a8a81b19dfa2810095c468c479..6ce11ff511a97a30f67f9d482d1368806ff21a94 100644 (file)
unlink(socket_path);
sdb_connection_close(conn);
+ sdb_object_deref(SDB_OBJ(conn));
pthread_join(thr, NULL);
}
END_TEST