Don't set socket timeout unless timeouts are expected.

This commit is contained in:
akwizgran
2013-04-09 14:03:12 +01:00
parent c8201c3eb0
commit 6a280944ba
2 changed files with 1 additions and 4 deletions

View File

@@ -153,7 +153,6 @@ class LanTcpPlugin extends TcpPlugin {
try {
// Connect back on the advertised TCP port
Socket s = new Socket(packet.getAddress(), port);
s.setSoTimeout(0);
return new TcpTransportConnection(s, maxLatency);
} catch(IOException e) {
if(LOG.isLoggable(WARNING))
@@ -291,7 +290,6 @@ class LanTcpPlugin extends TcpPlugin {
int wait = (int) (Math.min(end, nextPacket) - now);
ss.setSoTimeout(wait < 1 ? 1 : wait);
Socket s = ss.accept();
s.setSoTimeout(0);
return new TcpTransportConnection(s, maxLatency);
} catch(SocketTimeoutException e) {
now = clock.currentTimeMillis();

View File

@@ -78,6 +78,7 @@ abstract class TcpPlugin implements DuplexPlugin {
found = true;
break;
} catch(IOException e) {
if(LOG.isLoggable(INFO)) LOG.info("Failed to bind " + addr);
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
tryToClose(ss);
continue;
@@ -128,7 +129,6 @@ abstract class TcpPlugin implements DuplexPlugin {
Socket s;
try {
s = ss.accept();
s.setSoTimeout(0);
} catch(IOException e) {
// This is expected when the socket is closed
if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
@@ -179,7 +179,6 @@ abstract class TcpPlugin implements DuplexPlugin {
if(addr == null) return null;
Socket s = new Socket();
try {
s.setSoTimeout(0);
s.connect(addr);
return new TcpTransportConnection(s, maxLatency);
} catch(IOException e) {