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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 3 23:02:41 CST 2008


Author: file
Date: Thu Jan  3 23:02:41 2008
New Revision: 96448

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96448
Log:
Yet another TODO gone.

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=96448&r1=96447&r2=96448
==============================================================================
--- team/file/netsock2/main/netsock2.c (original)
+++ team/file/netsock2/main/netsock2.c Thu Jan  3 23:02:41 2008
@@ -102,7 +102,7 @@
 
 		/* 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));
+			ast_log(LOG_WARNING, "Failed to setup SSL on TLS connection from %s.\n", ast_netsock2_sa_get_address(&child_socket->addr));
 			AST_LIST_REMOVE(&parent->child_sockets, child_socket, list);
 			close(child_socket->fd);
 			ast_free(child_socket);
@@ -111,7 +111,7 @@
 		SSL_set_fd(child_socket->ssl, child_socket->fd);
 		/* Attempt to actually negotiate and accept the connection */
 		if (!(res = SSL_accept(child_socket->ssl)) || (res < 0)) {
-			ast_log(LOG_WARNING, "Failed to accept SSL connection from %s. Handshake was not successful.\n", ast_netsock2_sa_get_address(child_socket->addr));
+			ast_log(LOG_WARNING, "Failed to accept SSL connection from %s. Handshake was not successful.\n", ast_netsock2_sa_get_address(&child_socket->addr));
 			AST_LIST_REMOVE(&parent->child_sockets, child_socket, list);
 			close(child_socket->fd);
 			ast_free(child_socket);
@@ -198,7 +198,7 @@
 
 		/* Now as the last step... create the thread that will handle this socket */
 		if (ast_pthread_create_background(&child_socket->thread, NULL, netsock2_accept_thread, child_socket)) {
-			ast_log(LOG_WARNING, "Failed to create thread to handle connection from %s\n", ast_netsock2_sa_get_address(child_socket->addr));
+			ast_log(LOG_WARNING, "Failed to create thread to handle connection from %s\n", ast_netsock2_sa_get_address(&child_socket->addr));
 			ast_free(child_socket);
 			close(netsocket);
 			return 1;
@@ -521,7 +521,9 @@
 	if (socket_list->thread == AST_PTHREADT_NULL) {
 		if (ast_pthread_create_background(&socket_list->thread, NULL, netsock2_main_thread, socket_list)) {
 			ast_log(LOG_ERROR, "Failed to create main thread for socket list %p, bollocks.\n", socket_list);
-			/* TODO: Remove everything and free it */
+			AST_LIST_REMOVE(&socket_list->sockets, netsock2_socket, list);
+			ast_free(netsock2_socket);
+			close(netsocket);
 			return -1;
 		}
 	}




More information about the asterisk-commits mailing list