This commit is contained in:
地平线
2015-09-23 18:11:29 +08:00
parent 47f137da7f
commit 901e0ba745

View File

@@ -153,17 +153,20 @@ public class SocksRunner implements Runnable {
new StreamCompletionHandler(remoteChannel, channel).completed(0, null); new StreamCompletionHandler(remoteChannel, channel).completed(0, null);
} }
public synchronized void closeRunner(final Throwable e) { public void closeRunner(final Throwable e) {
if (closed) return; if (closed) return;
closed = true; synchronized (this) {
try { if (closed) return;
channel.close(); closed = true;
} catch (Throwable t) { try {
} channel.close();
context.offerBuffer(buffer); } catch (Throwable t) {
buffer = null; }
if (e != null && finest) { context.offerBuffer(buffer);
logger.log(Level.FINEST, "close socks channel by error", e); buffer = null;
if (e != null && finest) {
logger.log(Level.FINEST, "close socks channel by error", e);
}
} }
} }