Skip to content

Commit dbd99c3

Browse files
authored
better logging on failed TLS handshake (sipsorcery-org#1388)
* better logging on failed TLS handshake * change order of things
1 parent 0ec5b8b commit dbd99c3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/core/SIP/Channels/SIPTLSChannel.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,15 @@ protected async Task OnAcceptAsync(SIPStreamConnection streamConnection)
120120
}
121121
cts.Cancel();
122122

123+
if (resultTask.IsFaulted)
124+
{
125+
logger.LogWarning($"SIP TLS Channel failed to connect to remote host. The authentication handshake failed. Error: {resultTask.Exception?.Message} {resultTask.Exception?.InnerException?.Message} {resultTask.Exception?.StackTrace}");
126+
sslStream.Close();
127+
return;
128+
}
129+
123130
logger.LogDebug("SIP TLS Channel successfully upgraded accepted client to SSL stream for {ListeningSIPEndPoint}<-{RemoteSIPEndPoint}.", ListeningSIPEndPoint, streamConnection.RemoteSIPEndPoint);
124-
131+
125132

126133
//// Display the properties and settings for the authenticated stream.
127134
////DisplaySecurityLevel(sslStream);

0 commit comments

Comments
 (0)