[asterisk-commits] file: branch file/netsock2 r97635 - /team/file/netsock2/main/netsock2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 9 15:53:01 CST 2008


Author: file
Date: Wed Jan  9 15:53:01 2008
New Revision: 97635

URL: http://svn.digium.com/view/asterisk?view=rev&rev=97635
Log:
Add some debug messages to the TCP/TLS accept thread function.

Modified:
    team/file/netsock2/main/netsock2.c

Modified: team/file/netsock2/main/netsock2.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/main/netsock2.c?view=diff&rev=97635&r1=97634&r2=97635
==============================================================================
--- team/file/netsock2/main/netsock2.c (original)
+++ team/file/netsock2/main/netsock2.c Wed Jan  9 15:53:01 2008
@@ -96,11 +96,14 @@
 	struct ast_netsock2_socket *child_socket = data;
 	struct ast_netsock2_socket *parent = child_socket->parent;
 
+	ast_debug(1, "Accept thread starting for child socket %p of parent socket %p\n", child_socket, parent);
+
 #ifdef HAVE_OPENSSL
 	/* Do certificate negotiation if this is using the TLS transport */
 	if (parent->transport == AST_NETSOCK2_TRANSPORT_TLS) {
 		int res = 0;
 
+		ast_debug(1, "Setting up TLS on child socket %p of parent socket %p\n", child_socket, parent);
 		/* Create a new SSL session using the parent SSL context */
 		if (!(child_socket->ssl = SSL_new(parent->ssl_ctx))) {
 			ast_log(LOG_WARNING, "Failed to setup SSL on TLS connection from %s.\n", ast_netsock2_sa_get_address(&child_socket->addr));
@@ -122,8 +125,10 @@
 #endif
 
 	/* If whatever binded the socket wants a callback that this connected do it */
-	if (parent->on_connect)
+	if (parent->on_connect) {
+		ast_debug(1, "Calling connect callback for child socket %p of parent %p\n", child_socket, parent);
 		parent->on_connect(child_socket);
+	}
 
 	/* Now we essentially go into a loop until either they disconnect, the callback terminates them, or we are told to stop */
 	while (child_socket->thread != AST_PTHREADT_STOP) {
@@ -139,16 +144,21 @@
 	}
 
 	/* If whatever binded the socket wants a callback that this disconnected do it */
-	if (parent->on_disconnect)
+	if (parent->on_disconnect) {
+		ast_debug(1, "Calling disconnect callback for child socket %p of parent %p\n", child_socket, parent);
 		parent->on_disconnect(child_socket);
+	}
 
 #ifdef HAVE_OPENSSL
 	/* If using TLS let's terminate and free it */
 	if (parent->transport == AST_NETSOCK2_TRANSPORT_TLS) {
+		ast_debug(1, "Shutting down TLS on child socket %p of parent %p\n", child_socket, parent);
 		SSL_shutdown(child_socket->ssl);
 		SSL_free(child_socket->ssl);
 	}
 #endif
+
+	ast_debug(1, "Removing child socket %p from parent socket %p list and closing/freeing\n", child_socket, parent);
 
 	/* It is our responsibility to remove ourselves from the parent, nobody else will do it */
 	AST_LIST_REMOVE(&parent->child_sockets, child_socket, list);




More information about the asterisk-commits mailing list