Skip to content

Commit 9607aca

Browse files
Handle EAGAIN in SSL_get_error
1 parent 9a05041 commit 9607aca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ssl/ssl_lib.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
#include <algorithm>
144144

145145
#include <assert.h>
146+
#include <errno.h>
146147
#include <limits.h>
147148
#include <stdlib.h>
148149
#include <string.h>
@@ -1375,8 +1376,11 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
13751376
}
13761377
// An EOF was observed which violates the protocol, and the underlying
13771378
// transport does not participate in the error queue. Bubble up to the
1378-
// caller.
1379-
return SSL_ERROR_SYSCALL;
1379+
// caller. If errno is non-zero due to temporariy unavailability (e.g.
1380+
// non-blocking socket), continue with normal logic.
1381+
if (errno != 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
1382+
return SSL_ERROR_SYSCALL;
1383+
}
13801384
}
13811385

13821386
switch (ssl->s3->rwstate) {

0 commit comments

Comments
 (0)