Fix: relayd streams can be leaked on connection error
[lttng-tools.git] / src / bin / lttng-relayd / connection.c
index dab794147f5e37ac773f1a8c419e16374f02af88..eeaa0a559c74d3f7aa1ee6d5ffdfa146498ec195 100644 (file)
@@ -176,3 +176,27 @@ void connection_ht_add(struct lttng_ht *relay_connections_ht,
        conn->in_socket_ht = 1;
        conn->socket_ht = relay_connections_ht;
 }
+
+int connection_set_session(struct relay_connection *conn,
+               struct relay_session *session)
+{
+       int ret = 0;
+
+       assert(conn);
+       assert(session);
+       assert(!conn->session);
+
+       if (connection_get(conn)) {
+               if (session_get(session)) {
+                       conn->session = session;
+               } else {
+                       ERR("Failed to get session reference in connection_set_session()");
+                       ret = -1;
+               }
+               connection_put(conn);
+       } else {
+               ERR("Failed to get connection reference in connection_set_session()");
+               ret = -1;
+       }
+       return ret;
+}
This page took 0.027631 seconds and 4 git commands to generate.