add a destroy API call for a server instance
authorRussell Bryant <russell@russellbryant.com>
Tue, 4 Mar 2008 22:28:03 +0000 (22:28 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 4 Mar 2008 22:28:03 +0000 (22:28 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@105804 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
include/asterisk/tcptls.h
main/http.c
main/manager.c
main/tcptls.c

index 9fc627f..a239e3d 100644 (file)
@@ -2238,7 +2238,7 @@ cleanup:
        ast_free(me);
 cleanup2:
        fclose(ser->f);
-       ast_free(ser);
+       ser = ast_tcptls_server_instance_destroy(ser);
 
        if (req.socket.lock) {
                ast_mutex_destroy(req.socket.lock);
index 3d7a2c9..814e433 100644 (file)
@@ -166,4 +166,11 @@ void *ast_make_file_from_fd(void *data);
 HOOK_T ast_tcptls_server_read(struct ast_tcptls_server_instance *ser, void *buf, size_t count);
 HOOK_T ast_tcptls_server_write(struct ast_tcptls_server_instance *ser, void *buf, size_t count);
 
+/*!
+ * \brief Destroy a server instance
+ *
+ * \return NULL for convenience
+ */
+struct ast_tcptls_server_instance *ast_tcptls_server_instance_destroy(struct ast_tcptls_server_instance *i);
+
 #endif /* _ASTERISK_SERVER_H */
index 11db177..7588461 100644 (file)
@@ -827,7 +827,7 @@ static void *httpd_helper_thread(void *data)
 
 done:
        fclose(ser->f);
-       ast_free(ser);
+       ser = ast_tcptls_server_instance_destroy(ser);
        return NULL;
 }
 
index ec8362b..f8267a4 100644 (file)
@@ -2882,7 +2882,7 @@ static void *session_do(void *data)
        destroy_session(s);
 
 done:
-       ast_free(ser);
+       ser = ast_tcptls_server_instance_destroy(ser);
        return NULL;
 }
 
index d623420..658ab25 100644 (file)
@@ -446,3 +446,9 @@ void *ast_make_file_from_fd(void *data)
        else
                return ser;
 }
+
+struct ast_tcptls_server_instance *ast_tcptls_server_instance_destroy(struct ast_tcptls_server_instance *i)
+{
+       ast_free(i);
+       return NULL;
+}