commit
34e328f606
@ -59,7 +59,7 @@ class SctpNotificationHandler extends AbstractNotificationHandler {
|
||||
|
||||
@Override
|
||||
public HandlerResult handleNotification(ShutdownNotification notification, Object o) {
|
||||
Channels.fireChannelDisconnected(sctpChannel);
|
||||
sctpChannel.worker.close(sctpChannel, Channels.succeededFuture(sctpChannel));
|
||||
return HandlerResult.RETURN;
|
||||
}
|
||||
|
||||
|
@ -199,8 +199,7 @@ final class SctpSendBufferPool {
|
||||
final MessageInfo messageInfo = MessageInfo.createOutgoing(ch.association(), null, streamNo);
|
||||
messageInfo.payloadProtocolID(protocolId);
|
||||
messageInfo.streamNumber(streamNo);
|
||||
ch.send(buffer, messageInfo);
|
||||
return writtenBytes();
|
||||
return ch.send(buffer, messageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -245,8 +244,7 @@ final class SctpSendBufferPool {
|
||||
final MessageInfo messageInfo = MessageInfo.createOutgoing(ch.association(), null, streamNo);
|
||||
messageInfo.payloadProtocolID(protocolId);
|
||||
messageInfo.streamNumber(streamNo);
|
||||
ch.send(buffer, messageInfo);
|
||||
return writtenBytes();
|
||||
return ch.send(buffer, messageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -352,26 +352,12 @@ class SctpWorker implements Worker {
|
||||
final int predictedRecvBufSize = predictor.nextReceiveBufferSize();
|
||||
|
||||
boolean messageReceived = false;
|
||||
boolean failure = true;
|
||||
MessageInfo messageInfo = null;
|
||||
|
||||
ByteBuffer bb = recvBufferPool.acquire(predictedRecvBufSize);
|
||||
try {
|
||||
messageInfo = channel.channel.receive(bb, null, notificationHandler);
|
||||
if (messageInfo != null) {
|
||||
messageReceived = true;
|
||||
if (!messageInfo.isUnordered()) {
|
||||
failure = false;
|
||||
} else {
|
||||
if (logger.isErrorEnabled()) {
|
||||
logger.error("Received unordered SCTP Packet");
|
||||
}
|
||||
failure = true;
|
||||
}
|
||||
} else {
|
||||
messageReceived = false;
|
||||
failure = false;
|
||||
}
|
||||
messageReceived = messageInfo != null;
|
||||
} catch (ClosedChannelException e) {
|
||||
// Can happen, and does not need a user attention.
|
||||
} catch (Throwable t) {
|
||||
@ -401,7 +387,7 @@ class SctpWorker implements Worker {
|
||||
recvBufferPool.release(bb);
|
||||
}
|
||||
|
||||
if (channel.channel.isBlocking() && !messageReceived || failure) {
|
||||
if (channel.channel.isBlocking() && !messageReceived) {
|
||||
k.cancel(); // Some JDK implementations run into an infinite loop without this.
|
||||
close(channel, succeededFuture(channel));
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user