[core,tcp] return errno ETIMEDOUT on timeout

BIO_C_WAIT_READ and BIO_C_WAIT_WRITE now set errno = ETIMEDOUT
if a timeout occurred.
This commit is contained in:
Armin Novak 2024-06-24 10:30:38 +02:00
parent 8df1a9a52a
commit c4fe6e78e5
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105

View File

@ -263,8 +263,12 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
} while ((status < 0) && (errno == EINTR));
#endif
/* Convert timeout to error return */
if (status == 0)
errno = ETIMEDOUT;
}
break;
case BIO_C_WAIT_WRITE:
{
int timeout = (int)arg1;
@ -298,14 +302,12 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
} while ((status < 0) && (errno == EINTR));
#endif
/* Convert timeout to error return */
if (status == 0)
errno = ETIMEDOUT;
}
break;
default:
break;
}
switch (cmd)
{
case BIO_C_SET_FD:
if (arg2)
{
@ -336,11 +338,8 @@ static long transport_bio_simple_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
status = 1;
break;
case BIO_CTRL_DUP:
status = 1;
break;
case BIO_CTRL_FLUSH:
case BIO_CTRL_DUP:
status = 1;
break;