From ca252b1d35d3a36d17dff80a510d4fea4de6e586 Mon Sep 17 00:00:00 2001 From: lxsang Date: Fri, 5 Feb 2021 03:38:56 +0100 Subject: [PATCH] fix event-stream handling bug on proxy mode --- http_server.c | 9 ++++++++- lib/handle.c | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/http_server.c b/http_server.c index 5c7e1bb..2546fe6 100644 --- a/http_server.c +++ b/http_server.c @@ -1517,7 +1517,14 @@ char *post_data_decode(void *client, int len) } if (stat == 0) { - usleep(POLL_EVENT_TO*1000); + if (difftime(time(NULL), ((antd_client_t*)client)->last_io) > MAX_IO_WAIT_TIME) + { + stat = -1; + } + else + { + usleep(POLL_EVENT_TO*1000); + } } } diff --git a/lib/handle.c b/lib/handle.c index 79a3532..2353978 100644 --- a/lib/handle.c +++ b/lib/handle.c @@ -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;