aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-07 20:55:12 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-05-07 20:55:12 +0100
commit35e67fa3f01c3057af094168df00aa5153827de8 (patch)
treed770c0b3e15726081750a381e7d0c56f45c5ded9 /src
parentd6fc2656e21f77bb0bb9f546768afb43a63b4680 (diff)
downloadrspamd-35e67fa3f01c3057af094168df00aa5153827de8.tar.gz
rspamd-35e67fa3f01c3057af094168df00aa5153827de8.zip
[Minor] Allow to pass socket's ownership to http connection object
Diffstat (limited to 'src')
-rw-r--r--src/libserver/http/http_connection.c8
-rw-r--r--src/libserver/http/http_connection.h6
2 files changed, 14 insertions, 0 deletions
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
@@ -203,6 +203,12 @@ 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
* @return pubkey structure or NULL