httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r652541 - /httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c
Date Thu, 01 May 2008 14:47:45 GMT
Author: wrowe
Date: Thu May  1 07:47:44 2008
New Revision: 652541

URL: http://svn.apache.org/viewvc?rev=652541&view=rev
Log:
Studying the behavior of ftp clients against a slow uplink, I noted that
the clients will toggle the THROUGHPUT bit for the kernel.  Do the same
server-side when we establish a PORT/EPRT connection on behalf of the
client.

Modified:
    httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c?rev=652541&r1=652540&r2=652541&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_data_connection.c Thu May  1 07:47:44 2008
@@ -22,6 +22,11 @@
 
 #define FTP_BUILD
 #include "mod_ftp.h"
+#include "apr_portable.h"
+
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
 
 /*
  * ftp_reset_dataconn: Close any data channel listen/connect socket and
@@ -58,6 +63,9 @@
     apr_socket_t *s;
     apr_status_t rv, res;
     int n;
+#ifdef HAVE_NETINET_IP_H
+    int sd, sopt;
+#endif
 
     /*
      * handle err condition when the creation of the socket had failed, this
@@ -161,6 +169,15 @@
         fc->passive_created = -1;
     }
 
+#ifdef HAVE_NETINET_IP_H
+    sopt = IPTOS_THROUGHPUT;
+    if (((apr_os_sock_get(&sd, s)) == APR_SUCCESS) &&
+         (setsockopt(sd, SOL_IP, IP_TOS, &sopt, sizeof(sopt)) < 0)) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, errno, r->server,
+                     "Failed to set TOS priority");
+    }
+#endif
+
     rv = apr_socket_opt_set(fc->datasock, APR_SO_LINGER,
                             APR_MAX_SECS_TO_LINGER);
     if (rv != APR_SUCCESS) {



Mime
View raw message