mirror of
https://github.com/lxsang/ant-http
synced 2025-07-27 11:09:48 +02:00
fix high cpu usage when handling bad POST request
This commit is contained in:
@ -565,6 +565,10 @@ int antd_recv_upto(void *src, void *data, int len)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (difftime(time(NULL), source->last_io) > MAX_IO_WAIT_TIME)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
switch (err)
|
||||
{
|
||||
case SSL_ERROR_NONE:
|
||||
@ -603,6 +607,10 @@ int antd_recv_upto(void *src, void *data, int len)
|
||||
time(&source->last_io);
|
||||
return received;
|
||||
}
|
||||
else if (difftime(time(NULL), source->last_io) > MAX_IO_WAIT_TIME)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (received <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK))
|
||||
{
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user