Correctly guard against NotYetConnectedExceptions when handling RDHUP.
Motivation: Commit 2c1f17faa268b9a1b8ef8f1ddaf832d1397719a3 introduced a regression which could cause NotYetConnectedExceptions when handling RDHUP events. Modifications: Correct ignore NotYetConnectedException when handling RDHUP events. Result: No more regression.
This commit is contained in:
parent
53d4950704
commit
dcbef5ee6f
@ -33,6 +33,7 @@ import io.netty.util.ReferenceCountUtil;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.NotYetConnectedException;
|
||||||
import java.nio.channels.UnresolvedAddressException;
|
import java.nio.channels.UnresolvedAddressException;
|
||||||
|
|
||||||
import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
import static io.netty.util.internal.ObjectUtil.checkNotNull;
|
||||||
@ -348,19 +349,29 @@ abstract class AbstractEpollChannel extends AbstractChannel implements UnixChann
|
|||||||
try {
|
try {
|
||||||
fd().shutdown(true, false);
|
fd().shutdown(true, false);
|
||||||
clearEpollIn0();
|
clearEpollIn0();
|
||||||
pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
|
|
||||||
} catch (IOException ignored) {
|
} catch (IOException ignored) {
|
||||||
// We attempted to shutdown and failed, which means the input has already effectively been
|
// We attempted to shutdown and failed, which means the input has already effectively been
|
||||||
// shutdown.
|
// shutdown.
|
||||||
pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
|
fireEventAndClose(ChannelInputShutdownEvent.INSTANCE);
|
||||||
close(voidPromise());
|
return;
|
||||||
|
} catch (NotYetConnectedException ignore) {
|
||||||
|
// We attempted to shutdown and failed, which means the input has already effectively been
|
||||||
|
// shutdown.
|
||||||
|
fireEventAndClose(ChannelInputShutdownEvent.INSTANCE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
pipeline().fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE);
|
||||||
} else {
|
} else {
|
||||||
close(voidPromise());
|
close(voidPromise());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fireEventAndClose(Object evt) {
|
||||||
|
pipeline().fireUserEventTriggered(evt);
|
||||||
|
close(voidPromise());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void flush0() {
|
protected void flush0() {
|
||||||
// Flush immediately only when there's no pending flush.
|
// Flush immediately only when there's no pending flush.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user