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; MessageEvent currentWriteEvent;
SendBuffer currentWriteBuffer; SendBuffer currentWriteBuffer;
final SctpNotificationHandler notificationHandler = new SctpNotificationHandler(this);
public SctpChannelImpl(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, public SctpChannelImpl(Channel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink,
com.sun.nio.sctp.SctpChannel channel, SctpWorker worker) { com.sun.nio.sctp.SctpChannel channel, SctpWorker worker) {
super(parent, factory, pipeline, sink); super(parent, factory, pipeline, sink);

View File

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