process possible SSL error on connection reset

This commit is contained in:
Yakov Olkhovskiy 2024-08-25 00:11:31 -04:00 committed by GitHub
parent e7054029c4
commit d163880004
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -311,6 +311,14 @@ int SecureSocketImpl::sendBytes(const void* buffer, int length, int flags)
while (mustRetry(rc, remaining_time)); while (mustRetry(rc, remaining_time));
if (rc <= 0) if (rc <= 0)
{ {
// At this stage we still can have last not yet recieved SSL message containing SSL error
// so make a read to force SSL to process possible SSL error
if (SSL_get_error(_pSSL, rc) == SSL_ERROR_SYSCALL && SocketImpl::lastError() == POCO_ECONNRESET)
{
char c = 0;
SSL_read(_pSSL, &c, 1);
}
rc = handleError(rc); rc = handleError(rc);
if (rc == 0) throw SSLConnectionUnexpectedlyClosedException(); if (rc == 0) throw SSLConnectionUnexpectedlyClosedException();
} }