Class: Foxbat::Server
- Inherits:
-
Object
- Object
- Foxbat::Server
- Defined in:
- lib/foxbat/server.rb
Instance Method Summary collapse
-
#initialize(host, port, klass, options, block = nil) ⇒ Server
constructor
A new instance of Server.
- #start(threadpool) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(host, port, klass, options, block = nil) ⇒ Server
Returns a new instance of Server.
11 12 13 14 15 16 17 |
# File 'lib/foxbat/server.rb', line 11 def initialize(host, port, klass, , block=nil) if [:secure] @context = Security.setup_ssl_context([:keystore]) end @address = InetSocketAddress.new(host, port) @pipeline = Pipeline.new(klass || block, @context) end |
Instance Method Details
#start(threadpool) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/foxbat/server.rb', line 19 def start(threadpool) @factory = NioServerSocketChannelFactory.new(threadpool, threadpool) @bootstrap = ServerBootstrap.new(@factory) @bootstrap.setPipelineFactory(@pipeline) @bootstrap.bind(@address) end |
#stop ⇒ Object
26 27 |
# File 'lib/foxbat/server.rb', line 26 def stop end |