This commit is contained in:
Redkale
2018-05-30 18:48:52 +08:00
parent d5409518ed
commit ae8fb992fb
2 changed files with 6 additions and 5 deletions

View File

@@ -178,10 +178,7 @@ public abstract class Response<C extends Context, R extends Request<C>> {
this.servlet = null; this.servlet = null;
request.recycle(); request.recycle();
if (channel != null) { if (channel != null) {
try { channel.dispose();
if (channel.isOpen()) channel.close();
} catch (Exception e) {
}
channel = null; channel = null;
} }
this.inited = false; this.inited = false;

View File

@@ -227,7 +227,11 @@ public final class Transport {
if (!queue.isEmpty()) { if (!queue.isEmpty()) {
AsyncConnection conn; AsyncConnection conn;
while ((conn = queue.poll()) != null) { while ((conn = queue.poll()) != null) {
if (conn.isOpen()) return CompletableFuture.completedFuture(conn); if (conn.isOpen()) {
return CompletableFuture.completedFuture(conn);
} else {
conn.dispose();
}
} }
} }
return AsyncConnection.createTCP(group, sslContext, addr, supportTcpNoDelay(), factory.readTimeoutSeconds, factory.writeTimeoutSeconds); return AsyncConnection.createTCP(group, sslContext, addr, supportTcpNoDelay(), factory.readTimeoutSeconds, factory.writeTimeoutSeconds);