index 09f906c045183fc9ab4e6d59b538580d7eed5e1f..91a9710e6b8e4789b625bcab1448343a6770e410 100644 (file)
}
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);
/* reset */
sdb_strbuf_clear(conn->errbuf);
- if (sdb_proto_unmarshal_header(conn->buf, &conn->cmd, &conn->cmd_len))
+ if (sdb_proto_unmarshal_header(SDB_STRBUF_STR(conn->buf),
+ &conn->cmd, &conn->cmd_len) < 0)
return -1;
sdb_strbuf_skip(conn->buf, 0, 2 * sizeof(uint32_t));
if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
break;
- close(conn->fd);
- conn->fd = -1;
+ sdb_connection_close(conn);
return (int)status;
}
else if (! status) /* EOF */
/* 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 "