From: Vsevolod Stakhov Date: Thu, 7 May 2020 19:55:12 +0000 (+0100) Subject: [Minor] Allow to pass socket's ownership to http connection object X-Git-Tag: 2.6~442 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=35e67fa3f01c3057af094168df00aa5153827de8;p=rspamd.git [Minor] Allow to pass socket's ownership to http connection object --- diff --git a/src/libserver/http/http_connection.c b/src/libserver/http/http_connection.c index 4e880f216..050fb4285 100644 --- a/src/libserver/http/http_connection.c +++ b/src/libserver/http/http_connection.c @@ -2344,6 +2344,14 @@ rspamd_http_connection_set_key (struct rspamd_http_connection *conn, priv->local_key = rspamd_keypair_ref (key); } +void +rspamd_http_connection_own_socket (struct rspamd_http_connection *conn) +{ + struct rspamd_http_connection_private *priv = conn->priv; + + priv->flags |= RSPAMD_HTTP_CONN_OWN_SOCKET; +} + const struct rspamd_cryptobox_pubkey* rspamd_http_connection_get_peer_key (struct rspamd_http_connection *conn) { diff --git a/src/libserver/http/http_connection.h b/src/libserver/http/http_connection.h index 7c901fd2a..ada98d250 100644 --- a/src/libserver/http/http_connection.h +++ b/src/libserver/http/http_connection.h @@ -202,6 +202,12 @@ struct rspamd_http_connection *rspamd_http_connection_new_client_socket ( void rspamd_http_connection_set_key (struct rspamd_http_connection *conn, struct rspamd_cryptobox_keypair *key); +/** + * Transfer ownership on socket to an HTTP connection + * @param conn + */ +void rspamd_http_connection_own_socket (struct rspamd_http_connection *conn); + /** * Get peer's public key * @param conn connection structure