Author: jfrederic.clere(a)jboss.com
Date: 2012-03-27 12:31:59 -0400 (Tue, 27 Mar 2012)
New Revision: 2008
Modified:
branches/7.0.x/java/org/apache/tomcat/util/net/JIoEndpoint.java
branches/7.0.x/webapps/docs/changelog.xml
Log:
Fix AS7-3834.... Well work-around a JVM bug in fact...
Modified: branches/7.0.x/java/org/apache/tomcat/util/net/JIoEndpoint.java
===================================================================
--- branches/7.0.x/java/org/apache/tomcat/util/net/JIoEndpoint.java 2012-03-27 08:05:18
UTC (rev 2007)
+++ branches/7.0.x/java/org/apache/tomcat/util/net/JIoEndpoint.java 2012-03-27 16:31:59
UTC (rev 2008)
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.net.BindException;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
@@ -1077,9 +1078,21 @@
if (address == null) {
s = new Socket("localhost", port);
} else {
- s = new Socket(address, port);
- // setting soLinger to a small value will help shutdown the
- // connection quicker
+ if (address instanceof Inet6Address &&
((Inet6Address)address).isLinkLocalAddress()) {
+ /* We need to work-around a java6 bug with IPv6 */
+ String addressString = address.getHostAddress();
+ if (addressString.indexOf("%") != -1) {
+ String addressStringWithoutSuffix = addressString.substring(0,
addressString.indexOf("%"));
+ InetAddress addressWithoutSuffix =
InetAddress.getByName(addressStringWithoutSuffix);
+ s = new Socket (addressWithoutSuffix, port ,
addressWithoutSuffix, 0);
+ } else {
+ s = new Socket(address, port, address, 0);
+ }
+ } else {
+ s = new Socket(address, port);
+ }
+ // setting soLinger to a small value will help shutdown the
+ // connection quicker
s.setSoLinger(true, 0);
}
} catch (Exception e) {
Modified: branches/7.0.x/webapps/docs/changelog.xml
===================================================================
--- branches/7.0.x/webapps/docs/changelog.xml 2012-03-27 08:05:18 UTC (rev 2007)
+++ branches/7.0.x/webapps/docs/changelog.xml 2012-03-27 16:31:59 UTC (rev 2008)
@@ -19,6 +19,9 @@
<subsection name="Coyote">
<changelog>
<fix>
+ <jboss-jira>AS7-3834</jboss-jira>: Socket bind for JIoEndpoint fails
on shutdown when using link-local IPv6 address. (jfclere)
+ </fix>
+ <fix>
<jboss-jira>JBPAPP-8505</jboss-jira>: Add back the multi files logic
for Windows. (jfclere/mturk)
</fix>
</changelog>
Show replies by date