| Class | Session |
| In: |
lib/network/session.rb
|
| Parent: | Object |
The session class is a base class contains the minimum amount of attributes to reasonably maintain a socket session with a client.
| accepting | [RW] | |
| closing | [RW] | |
| connected | [RW] | |
| sock | [R] | |
| write_blocked | [RW] |
Create a new session object Used when opening both an acceptor or connection.
# File lib/network/session.rb, line 32 def initialize(server, sock=nil) @server = server # Reactor or connector associated with this session. @sock = sock # File descriptor handle for this session. @addr = "" # Network address of this socket. @accepting=@connected=@closing=@write_blocked=false end
handle_close is called when a close event occurs for this session.
# File lib/network/session.rb, line 54 def handle_close end
handle_input is called when an input event occurs for this session.
# File lib/network/session.rb, line 46 def handle_input end
handle_oob is called when an out of band data event occurs for this session.
# File lib/network/session.rb, line 59 def handle_oob end
handle_output is called when an output event occurs for this session.
# File lib/network/session.rb, line 50 def handle_output end
is_readable? tests if the socket is a candidate for select read {return] true if so, false if not
# File lib/network/session.rb, line 64 def is_readable? @connected || @accepting end
is_writable? tests if the socket is a candidate for select write {return] true if so, false if not
# File lib/network/session.rb, line 70 def is_writable? @write_blocked end