mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Don't set socket timeout unless timeouts are expected.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user