in = ctx.inboundMessageBuffer();
diff --git a/transport/src/main/java/io/netty/channel/ChannelFuture.java b/transport/src/main/java/io/netty/channel/ChannelFuture.java
index 98dca98a07..a464d04bcb 100644
--- a/transport/src/main/java/io/netty/channel/ChannelFuture.java
+++ b/transport/src/main/java/io/netty/channel/ChannelFuture.java
@@ -129,7 +129,7 @@ import java.util.concurrent.TimeUnit;
* connect timeout should be configured via a transport-specific option:
*
* // BAD - NEVER DO THIS
- * {@link ClientBootstrap} b = ...;
+ * {@link Bootstrap} b = ...;
* {@link ChannelFuture} f = b.connect(...);
* f.awaitUninterruptibly(10, TimeUnit.SECONDS);
* if (f.isCancelled()) {
@@ -143,7 +143,7 @@ import java.util.concurrent.TimeUnit;
* }
*
* // GOOD
- * {@link ClientBootstrap} b = ...;
+ * {@link Bootstrap} b = ...;
* // Configure the connect timeout option.
* b.setOption("connectTimeoutMillis", 10000);
* {@link ChannelFuture} f = b.connect(...);
diff --git a/transport/src/main/java/io/netty/channel/ChannelHandler.java b/transport/src/main/java/io/netty/channel/ChannelHandler.java
index 358c413d90..436b0f18b8 100644
--- a/transport/src/main/java/io/netty/channel/ChannelHandler.java
+++ b/transport/src/main/java/io/netty/channel/ChannelHandler.java
@@ -15,7 +15,6 @@
*/
package io.netty.channel;
-import io.netty.bootstrap.Bootstrap;
import io.netty.channel.group.ChannelGroup;
import java.lang.annotation.Documented;
@@ -87,7 +86,7 @@ import java.nio.channels.Channels;
* the confidential information:
*
* // Create a new handler instance per channel.
- * // See {@link Bootstrap#setPipelineFactory(ChannelPipelineFactory)}.
+ * // See {@link ClientBootstrap#setPipelineFactory(ChannelPipelineFactory)}.
* public class DataServerPipelineFactory implements {@link ChannelPipelineFactory} {
* public {@link ChannelPipeline} getPipeline() {
* return {@link Channels}.pipeline(new DataServerHandler());
diff --git a/transport/src/main/java/io/netty/channel/socket/SctpChannel.java b/transport/src/main/java/io/netty/channel/socket/SctpChannel.java
index 0fab200cdc..89015cb443 100644
--- a/transport/src/main/java/io/netty/channel/socket/SctpChannel.java
+++ b/transport/src/main/java/io/netty/channel/socket/SctpChannel.java
@@ -19,9 +19,7 @@ import com.sun.nio.sctp.Association;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
-import java.io.IOException;
import java.net.InetAddress;
-import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Set;
@@ -72,10 +70,21 @@ public interface SctpChannel extends Channel {
@Override
SocketAddress remoteAddress();
-
/**
* Return all remote addresses of the SCTP server channel.
* Please note that, it will return more than one address if the remote is using multi-homing.
*/
Set allRemoteAddresses();
+
+ /**
+ * Bind a address to the already bound channel to enable multi-homing.
+ * The Channel bust be bound and yet to be connected.
+ */
+ ChannelFuture bindAddress(InetAddress localAddress);
+
+ /**
+ * Unbind the address from channel's multi-homing address list.
+ * The address should be added already in multi-homing address list.
+ */
+ ChannelFuture unbindAddress(InetAddress localAddress);
}
diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java b/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java
index e8c643b224..113db6d8b9 100644
--- a/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java
+++ b/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java
@@ -253,6 +253,9 @@ final class NioEventLoop extends SingleThreadEventLoop {
private void processSelectedKeys() {
Set selectedKeys = selector.selectedKeys();
+ // check if the set is empty and if so just return to not create garbage by
+ // creating a new Iterator every time even if there is nothing to process.
+ // See https://github.com/netty/netty/issues/597
if (selectedKeys.isEmpty()) {
return;
}
diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioSctpChannel.java b/transport/src/main/java/io/netty/channel/socket/nio/NioSctpChannel.java
index 9b4c8f08c8..1efe2ff586 100644
--- a/transport/src/main/java/io/netty/channel/socket/nio/NioSctpChannel.java
+++ b/transport/src/main/java/io/netty/channel/socket/nio/NioSctpChannel.java
@@ -25,6 +25,7 @@ import io.netty.buffer.MessageBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelException;
+import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelMetadata;
import io.netty.channel.socket.DefaultSctpChannelConfig;
import io.netty.channel.socket.SctpChannelConfig;
@@ -34,6 +35,7 @@ import io.netty.logging.InternalLogger;
import io.netty.logging.InternalLoggerFactory;
import java.io.IOException;
+import java.net.InetAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
@@ -48,6 +50,7 @@ public class NioSctpChannel extends AbstractNioMessageChannel implements io.nett
private final SctpChannelConfig config;
+ @SuppressWarnings("rawtypes")
private final NotificationHandler notificationHandler;
private static SctpChannel newSctpChannel() {
@@ -215,6 +218,7 @@ public class NioSctpChannel extends AbstractNioMessageChannel implements io.nett
javaChannel().close();
}
+ @SuppressWarnings("unchecked")
@Override
protected int doReadMessages(MessageBuf