diff --git a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpNotificationHandler.java b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpNotificationHandler.java index 0fe6ab4094..5dff82f184 100644 --- a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpNotificationHandler.java +++ b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpNotificationHandler.java @@ -23,6 +23,7 @@ import com.sun.nio.sctp.PeerAddressChangeNotification; import com.sun.nio.sctp.SendFailedNotification; import com.sun.nio.sctp.ShutdownNotification; +import io.netty.channel.ChannelPipeline; import io.netty.channel.Channels; import io.netty.logging.InternalLogger; import io.netty.logging.InternalLoggerFactory; @@ -36,11 +37,11 @@ class SctpNotificationHandler extends AbstractNotificationHandler { InternalLoggerFactory.getInstance(SctpNotificationHandler.class); private final SctpChannelImpl sctpChannel; - private final SctpWorker sctpWorker; + private final ChannelPipeline pipeline; - public SctpNotificationHandler(SctpChannelImpl sctpChannel, SctpWorker sctpWorker) { + SctpNotificationHandler(SctpChannelImpl sctpChannel) { this.sctpChannel = sctpChannel; - this.sctpWorker = sctpWorker; + this.pipeline = sctpChannel.getPipeline(); } @Override @@ -49,12 +50,6 @@ class SctpNotificationHandler extends AbstractNotificationHandler { return HandlerResult.CONTINUE; } - @Override - public HandlerResult handleNotification(Notification notification, Object o) { - fireNotificationReceived(notification, o); - return HandlerResult.CONTINUE; - } - @Override public HandlerResult handleNotification(PeerAddressChangeNotification notification, Object o) { fireNotificationReceived(notification, o); @@ -69,11 +64,11 @@ class SctpNotificationHandler extends AbstractNotificationHandler { @Override public HandlerResult handleNotification(ShutdownNotification notification, Object o) { - sctpWorker.close(sctpChannel, Channels.succeededFuture(sctpChannel)); + Channels.fireChannelDisconnected(sctpChannel); return HandlerResult.RETURN; } private void fireNotificationReceived(Notification notification, Object o) { - sctpChannel.getPipeline().sendUpstream(new SctpNotificationEvent(sctpChannel, notification, o)); + pipeline.sendUpstream(new SctpNotificationEvent(sctpChannel, notification, o)); } } diff --git a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpWorker.java b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpWorker.java index e18d6b85df..4b0df5eff4 100644 --- a/transport-sctp/src/main/java/io/netty/channel/sctp/SctpWorker.java +++ b/transport-sctp/src/main/java/io/netty/channel/sctp/SctpWorker.java @@ -86,7 +86,7 @@ class SctpWorker implements Runnable { boolean server = !(channel instanceof SctpClientChannel); Runnable registerTask = new RegisterTask(channel, future, server); - notificationHandler = new SctpNotificationHandler(channel, this); + notificationHandler = new SctpNotificationHandler(channel); Selector selector; synchronized (startStopLock) {