Skip to content

Commit 03dee9b

Browse files
authored
Merge pull request #827 from jglick/connectTcp
No need to retry inside `connectTcp`
2 parents f132034 + 990305b commit 03dee9b

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

src/main/java/hudson/remoting/Engine.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,30 +1159,16 @@ private void onConnectionRejected(String greeting) throws InterruptedException {
11591159
}
11601160

11611161
/**
1162-
* Connects to TCP agent host:port, with a few retries.
1162+
* Connects to TCP agent host:port.
11631163
* @param endpoint Connection endpoint
11641164
* @throws IOException Connection failure or invalid parameter specification
11651165
*/
11661166
private Socket connectTcp(@NonNull JnlpAgentEndpoint endpoint) throws IOException, InterruptedException {
1167-
11681167
String msg = "Connecting to " + endpoint.getHost() + ':' + endpoint.getPort();
11691168
events.status(msg);
1170-
int retry = 1;
1171-
while (true) {
1172-
try {
1173-
final Socket s =
1174-
endpoint.open(SOCKET_TIMEOUT); // default is 30 mins. See PingThread for the ping interval
1175-
s.setKeepAlive(keepAlive);
1176-
return s;
1177-
} catch (IOException e) {
1178-
if (retry++ > 10) {
1179-
throw e;
1180-
}
1181-
// TODO refactor various sleep statements into a common method
1182-
TimeUnit.SECONDS.sleep(10);
1183-
events.status(msg + " (retrying:" + retry + ")", e);
1184-
}
1185-
}
1169+
Socket s = endpoint.open(SOCKET_TIMEOUT); // default is 30 mins. See PingThread for the ping interval
1170+
s.setKeepAlive(keepAlive);
1171+
return s;
11861172
}
11871173

11881174
/**

0 commit comments

Comments
 (0)