httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1453022 - /httpd/httpd/trunk/modules/proxy/mod_proxy_websocket.c
Date Tue, 05 Mar 2013 21:38:01 GMT
Author: jim
Date: Tue Mar  5 21:38:01 2013
New Revision: 1453022

URL: http://svn.apache.org/r1453022
Log:
Work around blocking issues...

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_websocket.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_websocket.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_websocket.c?rev=1453022&r1=1453021&r2=1453022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_websocket.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_websocket.c Tue Mar  5 21:38:01 2013
@@ -123,7 +123,7 @@ static int proxy_websocket_transfer(requ
                               "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(ap
         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(ap
             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(ap
             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(ap
             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 */
 };
-



Mime
View raw message