From c7591ef6bc6ad4c4e1c7f6a66de78b6ff70dc913 Mon Sep 17 00:00:00 2001
From: Kevin Harwell <kharwell@digium.com>
Date: Tue, 27 Jan 2015 22:58:44 +0000
Subject: [PATCH] tcptls: Bad file descriptor error when reloading chan_sip

While running through some scenarios using chan_sip and tcp a problem would
occur that resulted in a flood of bad file descriptor messages on the cli:

tcptls.c:712 ast_tcptls_server_root: Accept failed: Bad file descriptor

The message is received because the underlying socket has been closed, so is
valid. This is probably happening because unloading of chan_sip is not atomic.
That however is outside the scope of this patch. This patch simply stops the
logging of multiple occurrences of that message.

ASTERISK-24728 #close
Reported by: Thomas Thompson
Review: https://reviewboard.asterisk.org/r/4380/
........

Merged revisions 431218 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 431219 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/tcptls.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/tcptls.c b/main/tcptls.c
index 1930d61cf3..dd2f5ea671 100644
--- a/main/tcptls.c
+++ b/main/tcptls.c
@@ -708,8 +708,9 @@ void *ast_tcptls_server_root(void *data)
 		}
 		fd = ast_accept(desc->accept_fd, &addr);
 		if (fd < 0) {
-			if ((errno != EAGAIN) && (errno != EINTR)) {
+			if ((errno != EAGAIN) && (errno != EWOULDBLOCK) && (errno != EINTR) && (errno != ECONNABORTED)) {
 				ast_log(LOG_ERROR, "Accept failed: %s\n", strerror(errno));
+				break;
 			}
 			continue;
 		}
-- 
GitLab