Class: Foxbat::Pipeline
- Inherits:
-
Object
- Object
- Foxbat::Pipeline
- Includes:
- ChannelPipelineFactory
- Defined in:
- lib/foxbat/pipeline.rb
Constant Summary collapse
- HANDLER =
"handler"- SSL_HANDLER =
"ssl"
Instance Method Summary collapse
- #getPipeline ⇒ Object
-
#initialize(handler, group, client, options = {}, ssl_context = nil, &block) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #releaseExternalResources ⇒ Object
Constructor Details
#initialize(handler, group, client, options = {}, ssl_context = nil, &block) ⇒ Pipeline
Returns a new instance of Pipeline.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/foxbat/pipeline.rb', line 16 def initialize(handler, group, client, ={}, ssl_context=nil, &block) = @handler = handler @client_mode = client if handler.class == Module @handler = Class.new(EM::Connection) @handler.send(:include, handler) end @group = group @block = block @context = ssl_context end |
Instance Method Details
#getPipeline ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/foxbat/pipeline.rb', line 31 def getPipeline pipeline = Channels.pipeline if @context engine = Security.create_ssl_engine(@context, @client_mode) pipeline.addLast(SSL_HANDLER, SslHandler.new(engine)) end h = @handler.new() @block.call(h) if @block connection = NettyConnection.new(h, @group) pipeline.addLast(HANDLER, connection) pipeline end |
#releaseExternalResources ⇒ Object
45 46 47 |
# File 'lib/foxbat/pipeline.rb', line 45 def releaseExternalResources # todo end |