[#1723] invoke close in eventloop
This commit is contained in:
parent
c1d787bff7
commit
59c2fd8813
@ -498,23 +498,26 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
public ChannelFuture disconnect(final ChannelPromise promise) {
|
public ChannelFuture disconnect(final ChannelPromise promise) {
|
||||||
validatePromise(promise, false);
|
validatePromise(promise, false);
|
||||||
|
|
||||||
// Translate disconnect to close if the channel has no notion of disconnect-reconnect.
|
|
||||||
// So far, UDP/IP is the only transport that has such behavior.
|
|
||||||
if (!channel().metadata().hasDisconnect()) {
|
|
||||||
findContextOutbound().invokeClose(promise);
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
final DefaultChannelHandlerContext next = findContextOutbound();
|
final DefaultChannelHandlerContext next = findContextOutbound();
|
||||||
EventExecutor executor = next.executor();
|
EventExecutor executor = next.executor();
|
||||||
if (executor.inEventLoop()) {
|
if (executor.inEventLoop()) {
|
||||||
|
// Translate disconnect to close if the channel has no notion of disconnect-reconnect.
|
||||||
|
// So far, UDP/IP is the only transport that has such behavior.
|
||||||
|
if (!channel().metadata().hasDisconnect()) {
|
||||||
|
next.invokeClose(promise);
|
||||||
|
} else {
|
||||||
next.invokeDisconnect(promise);
|
next.invokeDisconnect(promise);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!channel().metadata().hasDisconnect()) {
|
||||||
|
next.invokeClose(promise);
|
||||||
|
} else {
|
||||||
next.invokeDisconnect(promise);
|
next.invokeDisconnect(promise);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user