fix event-stream handling bug on proxy mode

This commit is contained in:
lxsang 2021-02-05 03:38:56 +01:00
parent b9bd5e9ad1
commit ca252b1d35
2 changed files with 12 additions and 5 deletions

View File

@ -1516,10 +1516,17 @@ char *post_data_decode(void *client, int len)
readlen = (len - read) > BUFFLEN ? BUFFLEN : (len - read);
}
if (stat == 0)
{
if (difftime(time(NULL), ((antd_client_t*)client)->last_io) > MAX_IO_WAIT_TIME)
{
stat = -1;
}
else
{
usleep(POLL_EVENT_TO*1000);
}
}
}
if (read > 0)
query[read] = '\0';

View File

@ -565,10 +565,10 @@ int antd_recv_upto(void *src, void *data, int len)
}
else
{
if (difftime(time(NULL), source->last_io) > MAX_IO_WAIT_TIME)
/*if (difftime(time(NULL), source->last_io) > MAX_IO_WAIT_TIME)
{
return -1;
}
}*/
switch (err)
{
case SSL_ERROR_NONE:
@ -607,10 +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)
/*else if (difftime(time(NULL), source->last_io) > MAX_IO_WAIT_TIME)
{
return -1;
}
}*/
if (received <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK))
{
return 0;