vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Jun 6 19:59:56 2020 +0300| [b678041a2e607de4c9abbde3d231363067872ccd] | committer: Rémi Denis-Courmont
httpd: return progress status from I/O functions So the caller knows if the client needs to be polled or not. (cherry picked from commit e484fdda358813ebafe55f5aa8ffe7b77057c962) > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b678041a2e607de4c9abbde3d231363067872ccd --- src/network/httpd.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/network/httpd.c b/src/network/httpd.c index 0dffd6239e..6b7e3328f5 100644 --- a/src/network/httpd.c +++ b/src/network/httpd.c @@ -1267,7 +1267,7 @@ msg_type[] = }; -static void httpd_ClientRecv(httpd_client_t *cl) +static int httpd_ClientRecv(httpd_client_t *cl) { int i_len; @@ -1538,26 +1538,30 @@ static void httpd_ClientRecv(httpd_client_t *cl) } else cl->i_state = HTTPD_CLIENT_DEAD; /* connection failed */ - return; + return 0; } /* check if the client is to be set to dead */ if (i_len < 0) { #if defined(_WIN32) - if (WSAGetLastError() != WSAEWOULDBLOCK) + if (WSAGetLastError() == WSAEWOULDBLOCK) #else - if (errno != EAGAIN) + if (errno == EAGAIN) #endif - cl->i_state = HTTPD_CLIENT_DEAD; /* connection failed */ - return; + return -1; + + cl->i_state = HTTPD_CLIENT_DEAD; /* connection failed */ + return 0; } /* XXX: for QT I have to disable timeout. Try to find why */ if (cl->query.i_proto == HTTPD_PROTO_RTSP) cl->i_activity_timeout = 0; + + return 0; } -static void httpd_ClientSend(httpd_client_t *cl) +static int httpd_ClientSend(httpd_client_t *cl) { int i_len; @@ -1597,18 +1601,20 @@ static void httpd_ClientSend(httpd_client_t *cl) if (i_len == 0) { cl->i_state = HTTPD_CLIENT_DEAD; /* connection closed */ - return; + return 0; } if (i_len < 0) { #if defined(_WIN32) - if (WSAGetLastError() != WSAEWOULDBLOCK) + if (WSAGetLastError() == WSAEWOULDBLOCK) #else - if (errno != EAGAIN) + if (errno == EAGAIN) #endif - /* Connection failed, or hung up (EPIPE) */ - cl->i_state = HTTPD_CLIENT_DEAD; - return; + return -1; + + /* Connection failed, or hung up (EPIPE) */ + cl->i_state = HTTPD_CLIENT_DEAD; + return 0; } cl->i_buffer += i_len; @@ -1638,6 +1644,7 @@ static void httpd_ClientSend(httpd_client_t *cl) } else /* send finished */ cl->i_state = HTTPD_CLIENT_SEND_DONE; } + return 0; } static void httpd_ClientTlsHandshake(httpd_host_t *host, httpd_client_t *cl) _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
