From 3f8b439026ac5c6b8fda333046ad10bac84f82e2 Mon Sep 17 00:00:00 2001 From: Konstantin Goncharik Date: Mon, 13 Feb 2023 03:49:54 +0700 Subject: [PATCH] Fixed unexpected server disconnection due to SSL_ERROR_SYSCALL with errno == EAGAIN Seems like the documentation recommends just repeating the request --- src/Socket.hpp | 4 ++-- src/TLS.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Socket.hpp b/src/Socket.hpp index 46bc708..cc9aa4b 100644 --- a/src/Socket.hpp +++ b/src/Socket.hpp @@ -113,11 +113,11 @@ class Socket { return Code::Memory; case ETIMEDOUT: return Code::Timeout; + case ECONNABORTED: + return Code::Cancel; # if EAGAIN != EWOULDBLOCK case EAGAIN: # endif - case ECONNABORTED: - return Code::Cancel; case EWOULDBLOCK: case EINTR: return Code::Retry; diff --git a/src/TLS.cpp b/src/TLS.cpp index 8ea8176..111fc01 100644 --- a/src/TLS.cpp +++ b/src/TLS.cpp @@ -182,6 +182,9 @@ ::Code SocketTLS::interpretLibCode(const int code, const bool processed, const b case SSL_ERROR_WANT_WRITE: return WaitOut; case SSL_ERROR_SYSCALL: + if (ERR_get_error() == 0 && osErrorToCode(osError()) == mumble::Code::Retry) { + return Retry; + } m_closed = true; if (!processed) {