Class: Rhino::Server
- Inherits:
-
Object
- Object
- Rhino::Server
- Defined in:
- lib/rhino/server.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#sockets ⇒ Object
Returns the value of attribute sockets.
Instance Method Summary collapse
-
#initialize(application, sockets) ⇒ Server
constructor
A new instance of Server.
- #monitor ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(application, sockets) ⇒ Server
Returns a new instance of Server.
6 7 8 9 |
# File 'lib/rhino/server.rb', line 6 def initialize(application, sockets) self.application = application self.sockets = sockets end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
3 4 5 |
# File 'lib/rhino/server.rb', line 3 def application @application end |
#sockets ⇒ Object
Returns the value of attribute sockets.
4 5 6 |
# File 'lib/rhino/server.rb', line 4 def sockets @sockets end |
Instance Method Details
#monitor ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rhino/server.rb', line 22 def monitor selections, = IO.select(self.sockets) io, = selections begin socket, = io.accept http = Rhino::HTTP::new(socket, application) http.handle rescue Rhino::HTTP::Exception => exception Rhino.logger.log("EXCEPTION: #{exception.}") rescue ::Errno::ECONNRESET rescue ::Errno::ENOTCONN rescue ::Errno::EPIPE rescue ::Errno::EPROTOTYPE ensure socket.close end end |