diff -uNr asterisk-orig/main/tcptls.c asterisk/main/tcptls.c --- asterisk-orig/main/tcptls.c 2010-07-12 14:03:01.000000000 +0000 +++ asterisk/main/tcptls.c 2010-07-16 13:12:17.000000000 +0000 @@ -426,7 +426,12 @@ /* if a local address was specified, bind to it so the connection will originate from the desired address */ if (!ast_sockaddr_isnull(&desc->local_address)) { - setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); + if (setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)) ) { + ast_log(LOG_ERROR, "Failed to set socket option SO_REUSEADDR: %s\n",strerror(errno)); + } + if (setsockopt(desc->accept_fd, SOL_SOCKET, SO_KEEPALIVE, &x, sizeof(x)) ) { + ast_log(LOG_ERROR, "Failed to set socket option SO_KEEPALIVE: %s\n",strerror(errno)); + } if (ast_bind(desc->accept_fd, &desc->local_address)) { ast_log(LOG_ERROR, "Unable to bind %s to %s: %s\n", desc->name, @@ -493,7 +498,12 @@ return; } - setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)); + if (setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)) ) { + ast_log(LOG_ERROR, "Failed to set socket option SO_REUSEADDR: %s\n",strerror(errno)); + } + if (setsockopt(desc->accept_fd, SOL_SOCKET, SO_KEEPALIVE, &x, sizeof(x)) ) { + ast_log(LOG_ERROR, "Failed to set socket option SO_KEEPALIVE: %s\n",strerror(errno)); + } if (ast_bind(desc->accept_fd, &desc->local_address)) { ast_log(LOG_ERROR, "Unable to bind %s to %s: %s\n", desc->name,