-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
Fixed handling of the idle timeout in case the SOCKS proxy does not reply to the SOCKS bytes. Signed-off-by: Simone Bordet <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
import java.nio.charset.StandardCharsets; | ||
import java.util.Map; | ||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.TimeoutException; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
|
@@ -140,12 +141,21 @@ public void succeeded() | |
@Override | ||
public void failed(Throwable x) | ||
{ | ||
close(); | ||
if (LOG.isDebugEnabled()) | ||
LOG.debug("SOCKS4 failure", x); | ||
getEndPoint().close(x); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
joakime
Contributor
|
||
@SuppressWarnings("unchecked") | ||
Promise<Connection> promise = (Promise<Connection>)context.get(HttpClientTransport.HTTP_CONNECTION_PROMISE_CONTEXT_KEY); | ||
promise.failed(x); | ||
} | ||
|
||
@Override | ||
public boolean onIdleExpired() | ||
{ | ||
failed(new TimeoutException("Idle timeout expired")); | ||
return false; | ||
} | ||
|
||
@Override | ||
public void onFillable() | ||
{ | ||
|
Looking at this again, why are we only closing the endpoint on failure? Should we also do it on success, or on a close for any reason?