mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +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 {
|
try {
|
||||||
// Connect back on the advertised TCP port
|
// Connect back on the advertised TCP port
|
||||||
Socket s = new Socket(packet.getAddress(), port);
|
Socket s = new Socket(packet.getAddress(), port);
|
||||||
s.setSoTimeout(0);
|
|
||||||
return new TcpTransportConnection(s, maxLatency);
|
return new TcpTransportConnection(s, maxLatency);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
if(LOG.isLoggable(WARNING))
|
if(LOG.isLoggable(WARNING))
|
||||||
@@ -291,7 +290,6 @@ class LanTcpPlugin extends TcpPlugin {
|
|||||||
int wait = (int) (Math.min(end, nextPacket) - now);
|
int wait = (int) (Math.min(end, nextPacket) - now);
|
||||||
ss.setSoTimeout(wait < 1 ? 1 : wait);
|
ss.setSoTimeout(wait < 1 ? 1 : wait);
|
||||||
Socket s = ss.accept();
|
Socket s = ss.accept();
|
||||||
s.setSoTimeout(0);
|
|
||||||
return new TcpTransportConnection(s, maxLatency);
|
return new TcpTransportConnection(s, maxLatency);
|
||||||
} catch(SocketTimeoutException e) {
|
} catch(SocketTimeoutException e) {
|
||||||
now = clock.currentTimeMillis();
|
now = clock.currentTimeMillis();
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ abstract class TcpPlugin implements DuplexPlugin {
|
|||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
if(LOG.isLoggable(INFO)) LOG.info("Failed to bind " + addr);
|
||||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||||
tryToClose(ss);
|
tryToClose(ss);
|
||||||
continue;
|
continue;
|
||||||
@@ -128,7 +129,6 @@ abstract class TcpPlugin implements DuplexPlugin {
|
|||||||
Socket s;
|
Socket s;
|
||||||
try {
|
try {
|
||||||
s = ss.accept();
|
s = ss.accept();
|
||||||
s.setSoTimeout(0);
|
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
// This is expected when the socket is closed
|
// This is expected when the socket is closed
|
||||||
if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
|
if(LOG.isLoggable(INFO)) LOG.log(INFO, e.toString(), e);
|
||||||
@@ -179,7 +179,6 @@ abstract class TcpPlugin implements DuplexPlugin {
|
|||||||
if(addr == null) return null;
|
if(addr == null) return null;
|
||||||
Socket s = new Socket();
|
Socket s = new Socket();
|
||||||
try {
|
try {
|
||||||
s.setSoTimeout(0);
|
|
||||||
s.connect(addr);
|
s.connect(addr);
|
||||||
return new TcpTransportConnection(s, maxLatency);
|
return new TcpTransportConnection(s, maxLatency);
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user