summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/Network.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-04-16 15:13:08 +0200
committerBenoit Foucher <benoit@zeroc.com>2008-04-16 15:13:08 +0200
commite2192db01a917ff5322a2e76b4c8b097482a18c2 (patch)
treedd918e2d20e4db9fcbba69318e10a23485d7ea80 /java/src/IceInternal/Network.java
parentbug 3008 - IceSSL cleanup (diff)
downloadice-e2192db01a917ff5322a2e76b4c8b097482a18c2.tar.bz2
ice-e2192db01a917ff5322a2e76b4c8b097482a18c2.tar.xz
ice-e2192db01a917ff5322a2e76b4c8b097482a18c2.zip
Fixed for bug 3007
Diffstat (limited to 'java/src/IceInternal/Network.java')
-rw-r--r--java/src/IceInternal/Network.java35
1 files changed, 23 insertions, 12 deletions
diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java
index e181b51a714..36cad790163 100644
--- a/java/src/IceInternal/Network.java
+++ b/java/src/IceInternal/Network.java
@@ -357,10 +357,18 @@ public final class Network
throw se;
}
- if(addr.equals(fd.socket().getLocalSocketAddress()))
+ if(System.getProperty("os.name").equals("Linux"))
{
- closeSocketNoThrow(fd);
- throw new Ice.ConnectionRefusedException();
+ //
+ // Prevent self connect (self connect happens on Linux when a client tries to connect to
+ // a server which was just deactivated if the client socket re-uses the same ephemeral
+ // port as the server).
+ //
+ if(addr.equals(fd.socket().getLocalSocketAddress()))
+ {
+ closeSocketNoThrow(fd);
+ throw new Ice.ConnectionRefusedException();
+ }
}
return true;
}
@@ -379,16 +387,19 @@ public final class Network
{
throw new Ice.ConnectFailedException();
}
-
- //
- // Prevent self connect (self connect happens on Linux when a client tries to connect to
- // a server which was just deactivated if the client socket re-uses the same ephemeral
- // port as the server).
- //
- java.net.SocketAddress addr = fd.socket().getRemoteSocketAddress();
- if(addr != null && addr.equals(fd.socket().getLocalSocketAddress()))
+
+ if(System.getProperty("os.name").equals("Linux"))
{
- throw new Ice.ConnectionRefusedException();
+ //
+ // Prevent self connect (self connect happens on Linux when a client tries to connect to
+ // a server which was just deactivated if the client socket re-uses the same ephemeral
+ // port as the server).
+ //
+ java.net.SocketAddress addr = fd.socket().getRemoteSocketAddress();
+ if(addr != null && addr.equals(fd.socket().getLocalSocketAddress()))
+ {
+ throw new Ice.ConnectionRefusedException();
+ }
}
}
catch(java.net.ConnectException ex)