Skip to content
Snippets Groups Projects
Commit ec7f57ab authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Close Socket on unhandled TLS errors

While errors on transmit seem to be handled well, errors on receive
do not, especially through js_recv_line() which has been seen to
trigger a large number (hundreds) of ECONNRESET errors.  To prevent
this, simply close the socket when an otherwise unhandled error
occurs.

Almost certainly fixes that issue, but the underlying cause is still
undetermined.  The calling script (imapservice.js) was checking
Socket.is_connected after each recv_line() call, so if the socket
was actually reset, it would be expected to only call it once.

An alternative would be to explicitly handle the error that is
seen (CRYPT_ERROR_PARAM1), but let's try a generic fix first and see
of anything breaks because of it.  Most likely issue would be an
inability to recv() data after calling shutdown(), but I don't think
many people do that except to move the TIME_WAIT to where they want
it.
parent cb0a3bf5
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1538 passed
......@@ -242,8 +242,10 @@ static ptrdiff_t js_socket_recv(js_socket_private_t *p, void *buf, size_t len, i
ret = -1;
if (status == CRYPT_ERROR_TIMEOUT)
ret = 0;
else if (status != CRYPT_ERROR_COMPLETE)
else if (status != CRYPT_ERROR_COMPLETE) {
GCES(ret, p, estr, "popping data");
do_js_close(p, false);
}
}
}
if (ret == -1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment