Skip to content

Commit

Permalink
adamfisk#130 Changed backendConnectTimeout to connectTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Jan 30, 2014
1 parent 49f0415 commit e71f8df
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,19 @@ HttpProxyServerBootstrap withIdleConnectionTimeout(

/**
* <p>
* Specify the timeout for connecting to the backend server on a new
* Specify the timeout for connecting to the upstream server on a new
* connection, in milliseconds.
* </p>
*
* <p>
* Default = 40000
* </p>
*
* @param backendConnectTimeout
* @param connectTimeout
* @return
*/
HttpProxyServerBootstrap withBackendConnectTimeout(
int backendConnectTimeout);
HttpProxyServerBootstrap withConnectTimeout(
int connectTimeout);

/**
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class DefaultHttpProxyServer implements HttpProxyServer {
private final HttpFiltersSource filtersSource;
private final boolean useDnsSec;
private final boolean transparent;
private final int backendConnectTimeout;
private final int connectTimeout;
private volatile int idleConnectionTimeout;

/**
Expand Down Expand Up @@ -152,12 +152,12 @@ private DefaultHttpProxyServer(String name,
boolean transparent,
int idleConnectionTimeout,
Collection<ActivityTracker> activityTrackers,
int backendConnectTimeout) {
int connectTimeout) {
this(new ServerGroup(name), transportProtocol, address,
sslEngineSource, authenticateSslClients, proxyAuthenticator,
chainProxyManager,
mitmManager, filterSource, useDnsSec, transparent,
idleConnectionTimeout, activityTrackers, backendConnectTimeout);
idleConnectionTimeout, activityTrackers, connectTimeout);
}

/**
Expand Down Expand Up @@ -197,8 +197,8 @@ private DefaultHttpProxyServer(String name,
* The timeout (in seconds) for auto-closing idle connections.
* @param activityTrackers
* for tracking activity on this proxy
* @param backendConnectTimeout
* number of milliseconds to wait to connect o the backend server
* @param connectTimeout
* number of milliseconds to wait to connect to the upstream server
*/
private DefaultHttpProxyServer(ServerGroup serverGroup,
TransportProtocol transportProtocol,
Expand All @@ -213,7 +213,7 @@ private DefaultHttpProxyServer(ServerGroup serverGroup,
boolean transparent,
int idleConnectionTimeout,
Collection<ActivityTracker> activityTrackers,
int backendConnectTimeout) {
int connectTimeout) {
this.serverGroup = serverGroup;
this.transportProtocol = transportProtocol;
this.address = address;
Expand All @@ -229,7 +229,7 @@ private DefaultHttpProxyServer(ServerGroup serverGroup,
if (activityTrackers != null) {
this.activityTrackers.addAll(activityTrackers);
}
this.backendConnectTimeout = backendConnectTimeout;
this.connectTimeout = connectTimeout;
}

boolean isUseDnsSec() {
Expand All @@ -248,7 +248,7 @@ public void setIdleConnectionTimeout(int idleConnectionTimeout) {
this.idleConnectionTimeout = idleConnectionTimeout;
}

public int getBackendConnectTimeout() { return backendConnectTimeout; }
public int getConnectTimeout() { return connectTimeout; }

@Override
public InetSocketAddress getListenAddress() {
Expand All @@ -263,7 +263,7 @@ public HttpProxyServerBootstrap clone() {
sslEngineSource, authenticateSslClients, proxyAuthenticator,
chainProxyManager,
mitmManager, filtersSource, useDnsSec, transparent,
idleConnectionTimeout, activityTrackers, backendConnectTimeout);
idleConnectionTimeout, activityTrackers, connectTimeout);
}

@Override
Expand Down Expand Up @@ -554,7 +554,7 @@ private static class DefaultHttpProxyServerBootstrap implements
private int idleConnectionTimeout = 70;
private DefaultHttpProxyServer original;
private Collection<ActivityTracker> activityTrackers = new ConcurrentLinkedQueue<ActivityTracker>();
private int backendConnectTimeout = 40000;
private int connectTimeout = 40000;

private DefaultHttpProxyServerBootstrap() {
}
Expand All @@ -571,7 +571,7 @@ private DefaultHttpProxyServerBootstrap(
HttpFiltersSource filtersSource, boolean useDnsSec,
boolean transparent, int idleConnectionTimeout,
Collection<ActivityTracker> activityTrackers,
int backendConnectTimeout) {
int connectTimeout) {
this.original = original;
this.transportProtocol = transportProtocol;
this.address = address;
Expand All @@ -587,7 +587,7 @@ private DefaultHttpProxyServerBootstrap(
if (activityTrackers != null) {
this.activityTrackers.addAll(activityTrackers);
}
this.backendConnectTimeout = backendConnectTimeout;
this.connectTimeout = connectTimeout;
}

private DefaultHttpProxyServerBootstrap(Properties props) {
Expand All @@ -597,8 +597,8 @@ private DefaultHttpProxyServerBootstrap(Properties props) {
props, "transparent");
this.idleConnectionTimeout = ProxyUtils.extractInt(props,
"idle_connection_timeout");
this.backendConnectTimeout = ProxyUtils.extractInt(props,
"backend_connect_timeout");
this.connectTimeout = ProxyUtils.extractInt(props,
"connect_timeout");
}

@Override
Expand Down Expand Up @@ -712,9 +712,9 @@ public HttpProxyServerBootstrap withIdleConnectionTimeout(
}

@Override
public HttpProxyServerBootstrap withBackendConnectTimeout(
int backendConnectTimeout) {
this.backendConnectTimeout = backendConnectTimeout;
public HttpProxyServerBootstrap withConnectTimeout(
int connectTimeout) {
this.connectTimeout = connectTimeout;
return this;
}

Expand All @@ -737,14 +737,14 @@ transportProtocol, determineListenAddress(),
sslEngineSource, authenticateSslClients,
proxyAuthenticator, chainProxyManager, mitmManager,
filtersSource, useDnsSec, transparent,
idleConnectionTimeout, activityTrackers, backendConnectTimeout);
idleConnectionTimeout, activityTrackers, connectTimeout);
} else {
return new DefaultHttpProxyServer(
name, transportProtocol, determineListenAddress(),
sslEngineSource, authenticateSslClients,
proxyAuthenticator, chainProxyManager, mitmManager,
filtersSource, useDnsSec, transparent,
idleConnectionTimeout, activityTrackers, backendConnectTimeout);
idleConnectionTimeout, activityTrackers, connectTimeout);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ protected void initChannel(Channel ch) throws Exception {
initChannelPipeline(ch.pipeline(), initialRequest);
};
});
cb.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, proxyServer.getBackendConnectTimeout());
cb.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, proxyServer.getConnectTimeout());

if (localAddress != null) {
return cb.connect(remoteAddress, localAddress);
Expand Down

0 comments on commit e71f8df

Please sign in to comment.