Update to a working version of Scalariform
This commit is contained in:
parent
cae070bd93
commit
c66ce62d63
616 changed files with 5966 additions and 5436 deletions
|
|
@ -31,9 +31,9 @@ object Tcp extends ExtensionId[Tcp] with ExtensionIdProvider {
|
|||
* Represents an accepted incoming TCP connection.
|
||||
*/
|
||||
final case class IncomingConnection(
|
||||
localAddress: InetSocketAddress,
|
||||
localAddress: InetSocketAddress,
|
||||
remoteAddress: InetSocketAddress,
|
||||
flow: Flow[ByteString, ByteString, NotUsed]) {
|
||||
flow: Flow[ByteString, ByteString, NotUsed]) {
|
||||
|
||||
/**
|
||||
* Handles the connection using the given flow, which is materialized exactly once and the respective
|
||||
|
|
@ -87,12 +87,13 @@ final class Tcp(system: ExtendedActorSystem) extends akka.actor.Extension {
|
|||
* independently whether the client is still attempting to write. This setting is recommended
|
||||
* for servers, and therefore it is the default setting.
|
||||
*/
|
||||
def bind(interface: String,
|
||||
port: Int,
|
||||
backlog: Int = 100,
|
||||
options: immutable.Traversable[SocketOption] = Nil,
|
||||
halfClose: Boolean = false,
|
||||
idleTimeout: Duration = Duration.Inf): Source[IncomingConnection, Future[ServerBinding]] =
|
||||
def bind(
|
||||
interface: String,
|
||||
port: Int,
|
||||
backlog: Int = 100,
|
||||
options: immutable.Traversable[SocketOption] = Nil,
|
||||
halfClose: Boolean = false,
|
||||
idleTimeout: Duration = Duration.Inf): Source[IncomingConnection, Future[ServerBinding]] =
|
||||
Source.fromGraph(new ConnectionSourceStage(
|
||||
IO(IoTcp)(system),
|
||||
new InetSocketAddress(interface, port),
|
||||
|
|
@ -126,13 +127,13 @@ final class Tcp(system: ExtendedActorSystem) extends akka.actor.Extension {
|
|||
* for servers, and therefore it is the default setting.
|
||||
*/
|
||||
def bindAndHandle(
|
||||
handler: Flow[ByteString, ByteString, _],
|
||||
interface: String,
|
||||
port: Int,
|
||||
backlog: Int = 100,
|
||||
options: immutable.Traversable[SocketOption] = Nil,
|
||||
halfClose: Boolean = false,
|
||||
idleTimeout: Duration = Duration.Inf)(implicit m: Materializer): Future[ServerBinding] = {
|
||||
handler: Flow[ByteString, ByteString, _],
|
||||
interface: String,
|
||||
port: Int,
|
||||
backlog: Int = 100,
|
||||
options: immutable.Traversable[SocketOption] = Nil,
|
||||
halfClose: Boolean = false,
|
||||
idleTimeout: Duration = Duration.Inf)(implicit m: Materializer): Future[ServerBinding] = {
|
||||
bind(interface, port, backlog, options, halfClose, idleTimeout).to(Sink.foreach { conn: IncomingConnection ⇒
|
||||
conn.flow.join(handler).run()
|
||||
}).run()
|
||||
|
|
@ -154,12 +155,13 @@ final class Tcp(system: ExtendedActorSystem) extends akka.actor.Extension {
|
|||
* If set to false, the connection will immediately closed once the client closes its write side,
|
||||
* independently whether the server is still attempting to write.
|
||||
*/
|
||||
def outgoingConnection(remoteAddress: InetSocketAddress,
|
||||
localAddress: Option[InetSocketAddress] = None,
|
||||
options: immutable.Traversable[SocketOption] = Nil,
|
||||
halfClose: Boolean = true,
|
||||
connectTimeout: Duration = Duration.Inf,
|
||||
idleTimeout: Duration = Duration.Inf): Flow[ByteString, ByteString, Future[OutgoingConnection]] = {
|
||||
def outgoingConnection(
|
||||
remoteAddress: InetSocketAddress,
|
||||
localAddress: Option[InetSocketAddress] = None,
|
||||
options: immutable.Traversable[SocketOption] = Nil,
|
||||
halfClose: Boolean = true,
|
||||
connectTimeout: Duration = Duration.Inf,
|
||||
idleTimeout: Duration = Duration.Inf): Flow[ByteString, ByteString, Future[OutgoingConnection]] = {
|
||||
|
||||
val tcpFlow = Flow.fromGraph(new OutgoingConnectionStage(
|
||||
IO(IoTcp)(system),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue