Change socket options type from immutable.Traversable to Traversable

The problem with `immutable.Traversable` is that it doesn't allow the use of `Seq.apply` for socket options, since `Seq` is aliased to `scala.collection.Seq` and not `scala.collection.immutable.Seq` in `package object scala`. Even though technically nicer `immutable.Traversable` therefore hinders usability of the API, for a benefit that we don't consider worth the cost.

Conflicts:
	akka-io/src/main/scala/akka/io/TcpConnection.scala
This commit is contained in:
Mathias 2013-01-21 17:02:20 +01:00
parent a53848edfa
commit ba922fa2d7
5 changed files with 10 additions and 9 deletions

View file

@ -132,11 +132,11 @@ object Tcp extends ExtensionKey[TcpExt] {
case class Connect(remoteAddress: InetSocketAddress,
localAddress: Option[InetSocketAddress] = None,
options: immutable.Traversable[SocketOption] = Nil) extends Command
options: Traversable[SocketOption] = Nil) extends Command
case class Bind(handler: ActorRef,
endpoint: InetSocketAddress,
backlog: Int = 100,
options: immutable.Traversable[SocketOption] = Nil) extends Command
options: Traversable[SocketOption] = Nil) extends Command
case class Register(handler: ActorRef) extends Command
case object Unbind extends Command
@ -185,7 +185,7 @@ object Tcp extends ExtensionKey[TcpExt] {
case class RegisterOutgoingConnection(channel: SocketChannel)
case class RegisterServerSocketChannel(channel: ServerSocketChannel)
case class RegisterIncomingConnection(channel: SocketChannel, handler: ActorRef,
options: immutable.Traversable[SocketOption]) extends Command
options: Traversable[SocketOption]) extends Command
case class Retry(command: Command, retriesLeft: Int) { require(retriesLeft >= 0) }
case object ChannelConnectable
case object ChannelAcceptable

View file

@ -100,8 +100,8 @@ abstract class TcpConnection(val selector: ActorRef,
// AUXILIARIES and IMPLEMENTATION
/** use in subclasses to start the common machinery above once a channel is connected */
def completeConnect(commander: ActorRef, options: immutable.Traversable[SocketOption]): Unit = {
/** used in subclasses to start the common machinery above once a channel is connected */
def completeConnect(commander: ActorRef, options: Traversable[SocketOption]): Unit = {
options.foreach(_.afterConnect(channel.socket))
commander ! Connected(

View file

@ -17,7 +17,7 @@ class TcpIncomingConnection(_selector: ActorRef,
_channel: SocketChannel,
_tcp: TcpExt,
handler: ActorRef,
options: immutable.Traversable[SocketOption])
options: Traversable[SocketOption])
extends TcpConnection(_selector, _channel, _tcp) {
context.watch(handler) // sign death pact

View file

@ -18,7 +18,7 @@ class TcpListener(selector: ActorRef,
backlog: Int,
bindCommander: ActorRef,
settings: TcpExt#Settings,
options: immutable.Traversable[SocketOption]) extends Actor with ActorLogging {
options: Traversable[SocketOption]) extends Actor with ActorLogging {
context.watch(handler) // sign death pact
val channel = {

View file

@ -20,7 +20,7 @@ class TcpOutgoingConnection(_selector: ActorRef,
commander: ActorRef,
remoteAddress: InetSocketAddress,
localAddress: Option[InetSocketAddress],
options: immutable.Traversable[SocketOption])
options: Traversable[SocketOption])
extends TcpConnection(_selector, TcpOutgoingConnection.newSocketChannel(), _tcp) {
context.watch(commander) // sign death pact
@ -34,11 +34,12 @@ class TcpOutgoingConnection(_selector: ActorRef,
else {
selector ! RegisterOutgoingConnection(channel)
context.become(connecting(commander, options))
Seq(1,2,3)
}
def receive: Receive = PartialFunction.empty
def connecting(commander: ActorRef, options: immutable.Traversable[SocketOption]): Receive = {
def connecting(commander: ActorRef, options: Traversable[SocketOption]): Receive = {
case ChannelConnectable
try {
val connected = channel.finishConnect()