It maybe reasonable that the read_ready flag was cleared before the real read API called.

This commit is contained in:
zhengshuxin 2021-11-12 17:24:11 +08:00
parent 2f8f33631c
commit 9782fab652
3 changed files with 11 additions and 4 deletions

View File

@ -255,13 +255,20 @@ static int sys_read(ACL_VSTREAM *in, void *buf, size_t size)
{
int read_cnt, nagain = 0;
/* clear the read_ready flag first: we shouldn't clear the flag
* after read() API such as read_fn called, because in some case,
* the read_ready flag maybe set 1 again in order to invoke the
* IO event in non-blocking mode.
*/
in->read_ready = 0;
if (in->type == ACL_VSTREAM_TYPE_FILE) {
if (ACL_VSTREAM_FILE(in) == ACL_FILE_INVALID) {
in->read_ready = 0;
/* in->read_ready = 0; */
return -1;
}
} else if (ACL_VSTREAM_SOCK(in) == ACL_SOCKET_INVALID) {
in->read_ready = 0;
/* in->read_ready = 0; */
return -1;
}

View File

@ -214,7 +214,7 @@ private:
bool setup_ssl(acl::sslbase_conf& ssl_conf)
{
acl::sslbase_io* ssl = ssl_conf.open(true);
acl::sslbase_io* ssl = ssl_conf.create(true);
// 将 SSL IO 过程注册至异步流中
if (client_->setup_hook(ssl) == ssl) {

View File

@ -198,7 +198,7 @@ public:
// SSL 模式下,等待客户端发送握手信息
if (__ssl_conf != NULL) {
acl::sslbase_io* ssl = __ssl_conf->open(true);
acl::sslbase_io* ssl = __ssl_conf->create(true);
// 注册 SSL IO 过程的钩子
if (client->setup_hook(ssl) == ssl) {