Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,9 @@ void timedOut(ProxyToServerConnection serverConnection) {
@Override
protected void timedOut() {
// idle timeout fired on the client channel. if we aren't waiting on a response from a server, hang up
if (currentServerConnection == null || this.lastReadTime <= currentServerConnection.lastReadTime) {
// fix : disconnect when connect server error and lastReadTime == 0
if (currentServerConnection == null || this.lastReadTime <= currentServerConnection.lastReadTime
|| currentServerConnection.lastReadTime == 0 && currentServerConnection.is(ConnectionState.DISCONNECTED)) {
super.timedOut();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,16 @@ protected void disconnected() {
}
}
clientConnection.serverDisconnected(this);
// fix : return BAD_GATEWAY when connect server error and lastReadTime ==0
if (serverConnection.lastReadTime == 0) {
FullHttpResponse substituteResponse = ProxyUtils.createFullHttpResponse(HttpVersion.HTTP_1_1,
HttpResponseStatus.BAD_GATEWAY,
"Unable to parse response from server");
HttpHeaders.setKeepAlive(substituteResponse, false);
HttpResponse httpResponse = substituteResponse;
rememberCurrentResponse(httpResponse);
respondWith(httpResponse);
}
}

@Override
Expand Down