You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/11/11 21:00:26 UTC

svn commit: r713144 - in /tomcat/trunk/java/org/apache: coyote/http11/Http11NioProtocol.java tomcat/util/net/NioEndpoint.java tomcat/util/net/SocketProperties.java

Author: fhanik
Date: Tue Nov 11 12:00:26 2008
New Revision: 713144

URL: http://svn.apache.org/viewvc?rev=713144&view=rev
Log:
Fix socket properties usage so that we can decide if we want to accept the default value or if we want to use a preset value

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=713144&r1=713143&r2=713144&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Tue Nov 11 12:00:26 2008
@@ -132,10 +132,6 @@
         ep.setName(getName());
         ep.setHandler(cHandler);
         
-        //todo, determine if we even need these
-        ep.getSocketProperties().setRxBufSize(Math.max(ep.getSocketProperties().getRxBufSize(),getMaxHttpHeaderSize()));
-        ep.getSocketProperties().setTxBufSize(Math.max(ep.getSocketProperties().getTxBufSize(),getMaxHttpHeaderSize()));
-        
         try {
             ep.init();
             sslImplementation = new JSSEImplementation();

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=713144&r1=713143&r2=713144&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Tue Nov 11 12:00:26 2008
@@ -735,14 +735,7 @@
             return;
 
         serverSock = ServerSocketChannel.open();
-        int performanceConnectionTime = socketProperties.getPerformanceConnectionTime();
-        int performanceLatency= socketProperties.getPerformanceLatency();
-        int performanceBandwidth = socketProperties.getPerformanceBandwidth();
-        if (performanceConnectionTime != -1 && performanceLatency != -1 &&
-                performanceBandwidth != -1)
-            serverSock.socket().setPerformancePreferences(socketProperties.getPerformanceConnectionTime(),
-                                                      socketProperties.getPerformanceLatency(),
-                                                      socketProperties.getPerformanceBandwidth());
+        socketProperties.setProperties(serverSock.socket());
         InetSocketAddress addr = (address!=null?new InetSocketAddress(address,port):new InetSocketAddress(port));
         serverSock.socket().bind(addr,backlog); 
         serverSock.configureBlocking(true); //mimic APR behavior

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java?rev=713144&r1=713143&r2=713144&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketProperties.java Tue Nov 11 12:00:26 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.tomcat.util.net;
 
+import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketException;
 
@@ -205,87 +206,76 @@
             socket.setTrafficClass(soTrafficClass.intValue());
     }
 
+    public void setProperties(ServerSocket socket) throws SocketException{
+        if (rxBufSize != null)
+            socket.setReceiveBufferSize(rxBufSize.intValue());
+        if (performanceConnectionTime != null && performanceLatency != null &&
+                performanceBandwidth != null)
+            socket.setPerformancePreferences(
+                    performanceConnectionTime.intValue(),
+                    performanceLatency.intValue(),
+                    performanceBandwidth.intValue());
+        if (soReuseAddress != null)
+            socket.setReuseAddress(soReuseAddress.booleanValue());
+        if (soTimeout != null)
+            socket.setSoTimeout(soTimeout.intValue());
+    }
+
+    
     public boolean getDirectBuffer() {
         return directBuffer;
     }
 
     public boolean getOoBInline() {
-        if(ooBInline != null)
-            return ooBInline.booleanValue();
-        return false;
+        return ooBInline.booleanValue();
     }
 
     public int getPerformanceBandwidth() {
-        if(performanceBandwidth != null)
-            return performanceBandwidth.intValue();
-        return -1;
+        return performanceBandwidth.intValue();
     }
 
     public int getPerformanceConnectionTime() {
-        if(performanceConnectionTime!= null)
-            return performanceConnectionTime.intValue();
-        return -1;
-          
+        return performanceConnectionTime.intValue();
     }
 
     public int getPerformanceLatency() {
-        if(performanceLatency != null)
-            return performanceLatency.intValue();
-        return -1 ;
+        return performanceLatency.intValue();
     }
 
     public int getRxBufSize() {
-        if(rxBufSize != null)
-            return rxBufSize.intValue();
-        return -1;
+        return rxBufSize.intValue();
     }
 
     public boolean getSoKeepAlive() {
-        if(soKeepAlive != null)
-            return soKeepAlive.booleanValue();
-        return false;
+        return soKeepAlive.booleanValue();
     }
 
     public boolean getSoLingerOn() {
-        if(soLingerOn != null)
-            return soLingerOn.booleanValue();
-        return false;
+        return soLingerOn.booleanValue();
     }
 
     public int getSoLingerTime() {
-        if(soLingerTime != null)
-            return soLingerTime.intValue();
-        return -1;
+        return soLingerTime.intValue();
     }
 
     public boolean getSoReuseAddress() {
-        if(soReuseAddress != null)
-            return soReuseAddress.booleanValue();
-        return false;
+        return soReuseAddress.booleanValue();
     }
 
     public int getSoTimeout() {
-        if(soTimeout != null)
-            return soTimeout.intValue();
-        return -1;
+        return soTimeout.intValue();
     }
 
     public int getSoTrafficClass() {
-        if(soTrafficClass != null)
-            return soTrafficClass.intValue();
-        return -1;
+        return soTrafficClass.intValue();
     }
 
     public boolean getTcpNoDelay() {
-        if(tcpNoDelay != null)
-            return tcpNoDelay.booleanValue();
-        return false;
+        return tcpNoDelay.booleanValue();
     }
 
     public int getTxBufSize() {
-        if(txBufSize != null)
-            return txBufSize.intValue();
-        return -1;
+        return txBufSize.intValue();
     }
 
     public int getBufferPool() {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org