akka/akka — pull request #1867 by HawaiianSpork (2013-12-07 23:11:38+00:00)
Title: !act #3490 Changed the callback to SocketOption to accept a channel inst...

...ead of a Socket, this allows for using the nio features.

For example in Java 7 you can now join a multicast group:

case class JoinGroup(group: InetAddress, networkInterface: NetworkInterface) extends SocketOption {

override def afterConnect(c: DatagramChannel): Unit = {
c.join(group, networkInterface)
}
}

IO(Udp) ! Udp.Bind(self, new InetSocketAddress(MulticastListener.port),
options=List(ReuseAddress(true),
JoinGroup(MulticastListener.group, MulticastListener.interf)))

Other minor changes:

- changed all methods in SocketOption to take a Channel instead of a Socket. The socket can be gotten from the Channel but not the reverse.
- all methods that are called before the bind are now called beforeBind for consistency.
- All network connections now call the beforeBind and afterConnect.