Skip to content

Commit

Permalink
[JENKINS-36871] Use Blocking-I/O for the clients
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenc committed Aug 5, 2016
1 parent 19093e3 commit 41841e5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/hudson/remoting/Engine.java
Expand Up @@ -263,8 +263,9 @@ private void innerRun(IOHub hub, SSLContext context, ExecutorService service) {
List<JnlpProtocolHandler> protocols = new JnlpProtocolHandlerFactory(service)
.withIOHub(hub)
.withSSLContext(context)
.withPreferNonBlockingIO(false) // we only have one connection, prefer blocking I/O
.handlers();
Map<String,String> headers = new HashMap<String,String>();
final Map<String,String> headers = new HashMap<String,String>();
headers.put(JnlpConnectionState.CLIENT_NAME_KEY, slaveName);
headers.put(JnlpConnectionState.SECRET_KEY, secretKey);

Expand Down Expand Up @@ -362,7 +363,13 @@ public void beforeChannel(@NonNull JnlpConnectionState event) {

@Override
public void afterChannel(@NonNull JnlpConnectionState event) {

// store the new cookie for next connection attempt
String cookie = event.getProperty(JnlpConnectionState.COOKIE_KEY);
if (cookie == null) {
headers.remove(JnlpConnectionState.COOKIE_KEY);
} else {
headers.put(JnlpConnectionState.COOKIE_KEY, cookie);
}
}
}).get();
} catch (IOException ioe) {
Expand Down

0 comments on commit 41841e5

Please sign in to comment.