fix: the cpu usage of pn_listen thread reaches 100 percent

This commit is contained in:
liucc1997 2023-05-09 18:53:57 +00:00 committed by ob-robot
parent 6f318f70d3
commit 1d4a6804a0

View File

@ -74,7 +74,7 @@ static int dispatch_handle_event(dispatch_sk_t* s)
err = EIO;
}
} else if ((uint64_t)rbytes < sizeof(dispatch_head_t)) {
// do nothing;
err = EAGAIN;
} else if (h->magic != DISPATCH_MAGIC) {
listen_t* l = structof(s->fty, listen_t, sf);
int fd = 0;
@ -98,6 +98,7 @@ static int dispatch_handle_event(dispatch_sk_t* s)
err = -EINVAL;
} else if (h->len + sizeof(*h) > (uint64_t)rbytes) {
// need read more
err = EAGAIN;
} else {
err = call_dispatch_func(s, (const char*)(h+1), h->len);
}