From: Sebastian Harl Date: Mon, 15 Dec 2014 20:22:16 +0000 (+0100) Subject: connection: Use sdb_connection_close to close a connection. X-Git-Tag: sysdb-0.7.0~105 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=dc1152ab2cc7b340a0d3a73982516c0dd40c84d3 connection: Use sdb_connection_close to close a connection. --- diff --git a/src/frontend/connection.c b/src/frontend/connection.c index 09f906c..55843fd 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -201,9 +201,7 @@ connection_destroy(sdb_object_t *obj) } sdb_log(SDB_LOG_DEBUG, "frontend: Closing connection %s", obj->name); - if (conn->fd >= 0) - close(conn->fd); - conn->fd = -1; + sdb_connection_close(conn); if (conn->username) free(conn->username); @@ -404,8 +402,7 @@ connection_read(sdb_conn_t *conn) if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) break; - close(conn->fd); - conn->fd = -1; + sdb_connection_close(conn); return (int)status; } else if (! status) /* EOF */ @@ -516,8 +513,7 @@ sdb_connection_send(sdb_conn_t *conn, uint32_t code, /* tell other code that there was a problem and, more importantly, * make sure we don't try to send further logs to the connection */ - close(conn->fd); - conn->fd = -1; + sdb_connection_close(conn); conn->ready = 0; sdb_log(SDB_LOG_ERR, "frontend: Failed to send msg "