Class Reactor
In: lib/network/reactor.rb
Parent: Object
Reactor
TopLevel

The Reactor class defines a representation of a multiplexer based on a non-blocking select() server.

The network design is based on the Mesh project NetworkService code which was translated almost directly from C++, warts and all, which in turn is based on Schmidt’s Acceptor/Connector/Reactor patterns which may be found at citeseer.ist.psu.edu/schmidt97acceptor.html for an idea of how all these classes are supposed to interelate.

Methods

new   poll   register   start   stop   unregister  

Attributes

port  [R] 
service_filters  [R] 
service_io  [R] 
service_negotiation  [R] 
service_type  [R] 

Public Class methods

Constructor for Reactor

service_port
The port the server will listen on or client will connect to.
service_type
The type of service (:server or :client)
service_io
The service io handler (:sockio, :lineio, or :packetio)
service_negotiation
An array of telnet options the service will try to negotiate
  Valid options are
       :sga, :echo, :naws, :ttype, :zmp (negotiate default)
       :binary
service_filters
An array of io filters the service will use.
  Valid options are
    :filter  - attach dummy filter
    :debugfilter - attach debug filter (default)
    :telnetfilter - attach telnet filter (default)
    :colorfilter - attach color filter (default)
    :terminalfilter - attach terminal filter
address
Optional address for outgoing connection.

Public Instance methods

poll starts the Reactor running to process incoming connection, input and output requests. It also executes commands from input requests.

+tm_out*
time to poll in seconds

register adds a session to the registry [session]

Start initializes the reactor and gets it ready to accept incoming connections.

engine
The client engine that will be observing the acceptor.
return
true if server boots correctly, false if an error occurs.

stop requests each of the connections to disconnect in the server’s user list, deletes the connections, and erases them from the user list. It then closes its own listening port.

unregister removes a session from the registry [session]

[Validate]