Class: Iodine::Base::Listener

Inherits:
Protocol
  • Object
show all
Defined in:
lib/iodine/io.rb

Overview

the server listener Protocol.

Instance Attribute Summary

Attributes inherited from Protocol

#io

Instance Method Summary collapse

Methods inherited from Protocol

#close, #closed?, each, #id, #initialize, #on_close, #on_message, #on_shutdown, #ping, #read, #set_timeout, #ssl?, #timeout?, #write

Constructor Details

This class inherits a constructor from Iodine::Protocol

Instance Method Details

#callObject



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/iodine/io.rb', line 80

def call
	begin
		n_io = nil
		loop do
			n_io = @io.accept_nonblock
			# @protocol.accept(n_io, @ssl)
			Iodine.run n_io, @ssl, &(@accept_proc)
		end
	rescue Errno::EWOULDBLOCK => e

	rescue => e
		n_io.close if n_io && !n_io.closed?
		@stop = true
		raise e
	end
end

#on_openObject



75
76
77
78
79
# File 'lib/iodine/io.rb', line 75

def on_open
	@protocol = Iodine.protocol
	@ssl = Iodine.ssl
	@accept_proc = @protocol.method(:accept)
end