commit 35e67fa: [Minor] Allow to pass socket's ownership to http connection object

Vsevolod Stakhov vsevolod at highsecure.ru
Thu May 7 20:00:07 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-05-07 20:55:12 +0100
URL: https://github.com/rspamd/rspamd/commit/35e67fa3f01c3057af094168df00aa5153827de8

[Minor] Allow to pass socket's ownership to http connection object

---
 src/libserver/http/http_connection.c | 8 ++++++++
 src/libserver/http/http_connection.h | 6 ++++++
 2 files changed, 14 insertions(+)

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


More information about the Commits mailing list