class Cannon::Rpc::TcpAcceptor
- Cannon::Rpc::TcpAcceptor
- Reference
- Object
Overview
Accepts connections from a TCPServer
and calls TcpConnection#run
for
each new connection, using the passed Manager
.
Call #run
to start accepting connections.
Defined in:
cannon/rpc/tcp_acceptor.crConstructors
-
.new(manager : Manager, server : TCPServer, tcp_nodelay : Bool = false, sync : Bool = false)
Will accept connections from server and pass manager into the created
TcpConnection
.
Instance Method Summary
-
#close
Closes the server and stops accepting connections.
-
#manager : Manager
The used manager
-
#on_new_connection(&block : TcpConnection -> Nil)
Sets a handler called when a new connection was accepted.
-
#run
Starts accepting TCP connections, blocking the current Fiber, until
#close
is called. - #running? : Bool
-
#server : TCPServer
The used tcp server
Class methods inherited from class Object
to_cannon_io(io, value)
to_cannon_io
Constructor Detail
Will accept connections from server and pass manager into the
created TcpConnection
.
The tcp_nodelay and sync arguments will be set in all accepted TCP connections.
Instance Method Detail
Sets a handler called when a new connection was accepted.
If you want to reject it, just call #close
on the passed
TcpConnection
.