From cc30752eb71555ab651821da054e6bc4353d4ae8 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 9 Jan 2014 23:48:59 -0600 Subject: [PATCH] Only use a socket timeout when handshaking on the control stream. --- .../src/com/limelight/nvstream/control/ControlStream.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java b/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java index 3a96df8e..bba6da9d 100644 --- a/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java +++ b/moonlight-common/src/com/limelight/nvstream/control/ControlStream.java @@ -64,7 +64,6 @@ public class ControlStream implements ConnectionStatusListener { public void initialize() throws IOException { s = new Socket(); - s.setSoTimeout(CONTROL_TIMEOUT); s.setTcpNoDelay(true); s.connect(new InetSocketAddress(host, PORT), CONTROL_TIMEOUT); in = s.getInputStream(); @@ -140,10 +139,16 @@ public class ControlStream implements ConnectionStatusListener { public void start() throws IOException { + // Use a finite timeout during the handshake process + s.setSoTimeout(CONTROL_TIMEOUT); + sendConfig(); pingPong(); send1405AndGetResponse(); + // Return to an infinte read timeout after the initial control handshake + s.setSoTimeout(0); + heartbeatThread = new Thread() { @Override public void run() {