]> granicus.if.org Git - apache/commitdiff
Timeout/time fixes
authorWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 15 Jul 2002 07:46:19 +0000 (07:46 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Mon, 15 Jul 2002 07:46:19 +0000 (07:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96055 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_ftp.c
modules/proxy/proxy_http.c
modules/proxy/proxy_util.c
server/connection.c
server/core.c
server/mpm_common.c
server/rfc1413.c

index fc44581c7fe81b600e11b7e5d581e23596feaf8f..e05a92812cb9e13c1e619545265f51654601803c 100644 (file)
@@ -968,11 +968,10 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
 
     /* Set a timeout on the socket */
     if (conf->timeout_set == 1) {
-        apr_setsocketopt(sock, APR_SO_TIMEOUT, (int)conf->timeout);
+        apr_socket_timeout_set(sock, conf->timeout);
     }
     else {
-        apr_setsocketopt(sock, 
-                         APR_SO_TIMEOUT, (int)r->server->timeout);
+        apr_socket_timeout_set(sock, r->server->timeout);
     }
 
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
index f536ba47c826de865e59b3e849e285ecdf64f41f..bce637b2c2e1a9411dacb15cfbef2e1a536de6b4 100644 (file)
@@ -319,7 +319,7 @@ apr_status_t ap_proxy_http_create_connection(apr_pool_t *p, request_rec *r,
         apr_size_t buffer_len = 1;
         char test_buffer[1]; 
         apr_status_t socket_status;
-        apr_short_interval_time_t current_timeout;
+        apr_interval_time_t current_timeout;
 
         /* use previous keepalive socket */
         *origin = backend->connection;
@@ -327,12 +327,12 @@ apr_status_t ap_proxy_http_create_connection(apr_pool_t *p, request_rec *r,
         new = 0;
 
         /* save timeout */
-        apr_getsocketopt(p_conn->sock, APR_SO_TIMEOUT, &current_timeout);
+        apr_socket_timeout_get(p_conn->sock, &current_timeout);
         /* set no timeout */
-        apr_setsocketopt(p_conn->sock, APR_SO_TIMEOUT, 0);
+        apr_socket_timeout_set(p_conn->sock, 0);
         socket_status = apr_recv(p_conn->sock, test_buffer, &buffer_len);
         /* put back old timeout */
-        apr_setsocketopt(p_conn->sock, APR_SO_TIMEOUT, current_timeout);
+        apr_socket_timeout_set(p_conn->sock, current_timeout);
         if ( APR_STATUS_IS_EOF(socket_status) ) {
             ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
                          "proxy: HTTP: previous connection is closed");
index ffb30255b97eb9c70aa87a58cf45da485873d1be..3d0a4ffb9076871004997cd562ce5069d4275fd2 100644 (file)
@@ -1158,10 +1158,10 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
 
         /* Set a timeout on the socket */
         if (conf->timeout_set == 1) {
-            apr_setsocketopt(*newsock, APR_SO_TIMEOUT, (int)conf->timeout);
+            apr_socket_timeout_set(*newsock, conf->timeout);
         }
         else {
-            apr_setsocketopt(*newsock, APR_SO_TIMEOUT, (int)s->timeout);
+             apr_socket_timeout_set(*newsock, s->timeout);
         }
 
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
index e84d88a8da8abf5e0bef0a8f93af4d16a85eceeb..e960fc6c605ba6baf3c2677b283fe89e665dde63 100644 (file)
@@ -178,8 +178,8 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
      * not send us bytes within 2 seconds (a value pulled from Apache 1.3
      * which seems to work well), close the connection.
      */
-    timeout = SECONDS_TO_LINGER * APR_USEC_PER_SEC;
-    apr_setsocketopt(csd, APR_SO_TIMEOUT, timeout);
+    timeout = apr_time_from_sec(SECONDS_TO_LINGER);
+    apr_socket_timeout_set(csd, timeout);
     apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1);
     while (1) {
         nbytes = sizeof(dummybuf);
index 17c7b21bae50ccf5d3cdfb3d432b239d46d7b198..3b0603532a4735b06c976c58e76ffcdc01877d4b 100644 (file)
@@ -2686,11 +2686,11 @@ static apr_status_t sendfile_it_all(core_net_rec *c,
 {
     apr_status_t rv;
 #ifdef AP_DEBUG
-    apr_int32_t timeout = 0;
+    apr_interval_time_t timeout = 0;
 #endif
 
-    AP_DEBUG_ASSERT((apr_getsocketopt(c->client_socket, APR_SO_TIMEOUT,
-                                      &timeout) == APR_SUCCESS)
+    AP_DEBUG_ASSERT((apr_socket_timeout_get(c->client_socket, &timeout) 
+                         == APR_SUCCESS)
                     && timeout > 0);  /* socket must be in timeout mode */
 
     do {
@@ -3308,16 +3308,15 @@ static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b,
 
     if (mode != AP_MODE_INIT && mode != AP_MODE_EATCRLF) {
         if (*first_line) {
-            apr_setsocketopt(csd, APR_SO_TIMEOUT,
-                             (int)(keptalive
-                      ? f->c->base_server->keep_alive_timeout
-                      : f->c->base_server->timeout));
+            apr_socket_timeout_set(csd, 
+                                   keptalive
+                                      ? f->c->base_server->keep_alive_timeout
+                                      : f->c->base_server->timeout);
             *first_line = 0;
         }
         else {
             if (keptalive) {
-                apr_setsocketopt(csd, APR_SO_TIMEOUT,
-                                 (int)(f->c->base_server->timeout));
+                apr_socket_timeout_set(csd, f->c->base_server->timeout);
             }
         }
     }
index 2cd2c8e02023cf227a02183f17647fb3773e0b26..1ebca2de64fbb8f8a908b11ad9c683591de13361 100644 (file)
@@ -494,7 +494,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
      * because the MPM won't want to hold up a graceful restart for a
      * long time
      */
-    rv = apr_setsocketopt(sock, APR_SO_TIMEOUT, 3 * APR_USEC_PER_SEC);
+    rv = apr_socket_timeout_set(sock, apr_time_from_sec(3));
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_WARNING, rv, ap_server_conf,
                      "set timeout on socket to connect to listener");
index 5c11187b11a3dc299b6bf174189e3441edadd6ea..89c3edf494a7a1dd9cbbb4ce4fd1fb09c065920b 100644 (file)
@@ -147,10 +147,9 @@ static apr_status_t rfc1413_connect(apr_socket_t **newsock, conn_rec *conn,
         return rv;
     }
 
-    if ((rv = apr_setsocketopt(*newsock, APR_SO_TIMEOUT, 
-                               (apr_int32_t)(ap_rfc1413_timeout 
-                                              * APR_USEC_PER_SEC)))
-        != APR_SUCCESS) {
+    if ((rv = apr_socket_timeout_set(*newsock, APR_SO_TIMEOUT, 
+                                     apr_time_from_sec(ap_rfc1413_timeout)))
+            != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, srv,
                      "rfc1413: error setting query socket timeout");
         apr_socket_close(*newsock);