!str #17031 Use host and port instead of InetSocketAddress
* as convenience in bind and outgoingConnection
This commit is contained in:
parent
f5cafd0342
commit
07f299a1e0
8 changed files with 68 additions and 45 deletions
|
|
@ -39,11 +39,10 @@ class HttpExt(config: Config)(implicit system: ActorSystem) extends akka.actor.E
|
|||
options: immutable.Traversable[Inet.SocketOption] = Nil,
|
||||
settings: ServerSettings = ServerSettings(system),
|
||||
log: LoggingAdapter = system.log)(implicit fm: FlowMaterializer): Source[IncomingConnection, Future[ServerBinding]] = {
|
||||
val endpoint = new InetSocketAddress(interface, port)
|
||||
val connections: Source[StreamTcp.IncomingConnection, Future[StreamTcp.ServerBinding]] =
|
||||
StreamTcp().bind(endpoint, backlog, options, settings.timeouts.idleTimeout)
|
||||
val connections: Source[Tcp.IncomingConnection, Future[Tcp.ServerBinding]] =
|
||||
Tcp().bind(interface, port, backlog, options, settings.timeouts.idleTimeout)
|
||||
connections.map {
|
||||
case StreamTcp.IncomingConnection(localAddress, remoteAddress, flow) ⇒
|
||||
case Tcp.IncomingConnection(localAddress, remoteAddress, flow) ⇒
|
||||
val layer = serverLayer(settings, log)
|
||||
IncomingConnection(localAddress, remoteAddress, layer join flow)
|
||||
}.mapMaterialized {
|
||||
|
|
@ -145,7 +144,7 @@ class HttpExt(config: Config)(implicit system: ActorSystem) extends akka.actor.E
|
|||
val remoteAddr = new InetSocketAddress(host, port)
|
||||
val layer = clientLayer(remoteAddr, settings, log)
|
||||
|
||||
val transportFlow = StreamTcp().outgoingConnection(remoteAddr, localAddress,
|
||||
val transportFlow = Tcp().outgoingConnection(remoteAddr, localAddress,
|
||||
options, settings.connectingTimeout, settings.idleTimeout)
|
||||
|
||||
layer.joinMat(transportFlow) { (_, tcpConnFuture) ⇒
|
||||
|
|
|
|||
|
|
@ -259,7 +259,8 @@ class ConnectionPoolSpec extends AkkaSpec("akka.loggers = []\n akka.loglevel = O
|
|||
BidiShape(top.inlet, top.outlet, bottom.inlet, bottom.outlet)
|
||||
}
|
||||
val sink = if (autoAccept) Sink.foreach[Http.IncomingConnection](handleConnection) else Sink(incomingConnections)
|
||||
StreamTcp().bind(serverEndpoint, idleTimeout = serverSettings.timeouts.idleTimeout)
|
||||
// TODO getHostString in Java7
|
||||
StreamTcp().bind(serverEndpoint.getHostName, serverEndpoint.getPort, idleTimeout = serverSettings.timeouts.idleTimeout)
|
||||
.map { c ⇒
|
||||
val layer = Http().serverLayer(serverSettings, log)
|
||||
Http.IncomingConnection(c.localAddress, c.remoteAddress, layer atop rawBytesInjection join c.flow)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue