diff options
author | Jim Jagielski <jim@apache.org> | 2013-03-05 22:38:01 +0100 |
---|---|---|
committer | Jim Jagielski <jim@apache.org> | 2013-03-05 22:38:01 +0100 |
commit | 2f876d8c48d3c9843049702f3634c33bfbd81249 (patch) | |
tree | 6b258231b30e5ec305bcf0048cb4e97a74829b06 /modules/proxy/mod_proxy_websocket.c | |
parent | We need to ensure a conn_rec (diff) | |
download | apache2-2f876d8c48d3c9843049702f3634c33bfbd81249.tar.xz apache2-2f876d8c48d3c9843049702f3634c33bfbd81249.zip |
Work around blocking issues...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1453022 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | modules/proxy/mod_proxy_websocket.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/proxy/mod_proxy_websocket.c b/modules/proxy/mod_proxy_websocket.c index 10ea8eca45..c23307077b 100644 --- a/modules/proxy/mod_proxy_websocket.c +++ b/modules/proxy/mod_proxy_websocket.c @@ -123,7 +123,7 @@ static int proxy_websocket_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o "error on %s - ap_pass_brigade", name); } - } else if (!APR_STATUS_IS_EAGAIN(rv)) { + } else if (!APR_STATUS_IS_EAGAIN(rv) && !APR_STATUS_IS_EOF(rv)) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, APLOGNO() "error on %s - ap_get_brigade", name); @@ -168,6 +168,11 @@ static int ap_proxy_websocket_request(apr_pool_t *p, request_rec *r, return HTTP_INTERNAL_SERVER_ERROR; } + apr_socket_opt_set(sock, APR_SO_NONBLOCK, 1); + apr_socket_opt_set(sock, APR_SO_KEEPALIVE, 1); + apr_socket_opt_set(client_socket, APR_SO_NONBLOCK, 1); + apr_socket_opt_set(client_socket, APR_SO_KEEPALIVE, 1); + pollfd.p = p; pollfd.desc_type = APR_POLL_SOCKET; pollfd.reqevents = APR_POLLIN; @@ -193,10 +198,8 @@ static int ap_proxy_websocket_request(apr_pool_t *p, request_rec *r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO() "error apr_poll()"); return HTTP_INTERNAL_SERVER_ERROR; } -#ifdef DEBUGGING ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO() "woke from poll(), i=%d", pollcnt); -#endif for (pi = 0; pi < pollcnt; pi++) { const apr_pollfd_t *cur = &signalled[pi]; @@ -204,10 +207,8 @@ static int ap_proxy_websocket_request(apr_pool_t *p, request_rec *r, if (cur->desc.s == sock) { pollevent = cur->rtnevents; if (pollevent & APR_POLLIN) { -#ifdef DEBUGGING ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO() "sock was readable"); -#endif rv = proxy_websocket_transfer(r, backconn, c, bb, "sock"); } else if ((pollevent & APR_POLLERR) @@ -222,10 +223,8 @@ static int ap_proxy_websocket_request(apr_pool_t *p, request_rec *r, else if (cur->desc.s == client_socket) { pollevent = cur->rtnevents; if (pollevent & APR_POLLIN) { -#ifdef DEBUGGING ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO() "client was readable"); -#endif rv = proxy_websocket_transfer(r, c, backconn, bb, "client"); } } @@ -350,4 +349,3 @@ AP_DECLARE_MODULE(proxy_websocket) = { NULL, /* command apr_table_t */ ap_proxy_http_register_hook /* register hooks */ }; - |