mirror of
https://github.com/openssl/openssl.git
synced 2024-12-03 05:41:46 +08:00
Teach more BIOs how to handle BIO_CTRL_EOF
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> (Merged from https://github.com/openssl/openssl/pull/10907)
This commit is contained in:
parent
d924dbf4ae
commit
6d53ad6b5c
@ -526,7 +526,12 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
break;
|
||||
case BIO_CTRL_DUP:
|
||||
break;
|
||||
|
||||
case BIO_CTRL_EOF:
|
||||
if (b->next_bio == NULL)
|
||||
ret = 0;
|
||||
else
|
||||
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
@ -313,6 +313,8 @@ static int conn_read(BIO *b, char *out, int outl)
|
||||
if (ret <= 0) {
|
||||
if (BIO_sock_should_retry(ret))
|
||||
BIO_set_retry_read(b);
|
||||
else if (ret == 0)
|
||||
b->flags |= BIO_FLAGS_IN_EOF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -492,6 +494,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
*fptr = data->info_callback;
|
||||
}
|
||||
break;
|
||||
case BIO_CTRL_EOF:
|
||||
ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
@ -123,6 +123,8 @@ static int fd_read(BIO *b, char *out, int outl)
|
||||
if (ret <= 0) {
|
||||
if (BIO_fd_should_retry(ret))
|
||||
BIO_set_retry_read(b);
|
||||
else if (ret == 0)
|
||||
b->flags |= BIO_FLAGS_IN_EOF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -186,6 +188,9 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
case BIO_CTRL_FLUSH:
|
||||
ret = 1;
|
||||
break;
|
||||
case BIO_CTRL_EOF:
|
||||
ret = (b->flags & BIO_FLAGS_IN_EOF) != 0 ? 1 : 0;
|
||||
break;
|
||||
default:
|
||||
ret = 0;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user