Fix usage of SctpNotificationHandler. See #245

This commit is contained in:
Norman Maurer 2012-03-29 18:22:50 +02:00
parent b98516536e
commit 6184456689
2 changed files with 3 additions and 4 deletions

View File

@ -72,6 +72,8 @@ class SctpChannelImpl extends AbstractChannel implements SctpChannel {
MessageEvent currentWriteEvent;
SendBuffer currentWriteBuffer;
final SctpNotificationHandler notificationHandler = new SctpNotificationHandler(this);
public SctpChannelImpl(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink,
com.sun.nio.sctp.SctpChannel channel, SctpWorker worker) {
super(parent, factory, pipeline, sink);

View File

@ -87,8 +87,6 @@ class SctpWorker implements Worker {
private final SctpReceiveBufferPool recvBufferPool = new SctpReceiveBufferPool();
private final SctpSendBufferPool sendBufferPool = new SctpSendBufferPool();
private SctpNotificationHandler notificationHandler;
SctpWorker(Executor executor) {
this.executor = executor;
}
@ -97,7 +95,6 @@ class SctpWorker implements Worker {
boolean server = !(channel instanceof SctpClientChannel);
Runnable registerTask = new RegisterTask(channel, future, server);
notificationHandler = new SctpNotificationHandler(channel);
Selector selector;
synchronized (startStopLock) {
@ -354,7 +351,7 @@ class SctpWorker implements Worker {
ByteBuffer bb = recvBufferPool.acquire(predictedRecvBufSize);
try {
messageInfo = channel.channel.receive(bb, null, notificationHandler);
messageInfo = channel.channel.receive(bb, null, channel.notificationHandler);
messageReceived = messageInfo != null;
} catch (ClosedChannelException e) {
// Can happen, and does not need a user attention.