Class: SocketProxy::SessionPool
- Inherits:
-
Object
- Object
- SocketProxy::SessionPool
- Defined in:
- lib/socket_proxy.rb
Defined Under Namespace
Classes: Session
Instance Method Summary collapse
- #add(svrsock, clntsock) ⇒ Object
- #del(session) ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ SessionPool
constructor
A new instance of SessionPool.
- #sockets ⇒ Object
Constructor Details
#initialize ⇒ SessionPool
Returns a new instance of SessionPool.
59 60 61 62 |
# File 'lib/socket_proxy.rb', line 59 def initialize @pool = [] @sockets = [] end |
Instance Method Details
#add(svrsock, clntsock) ⇒ Object
74 75 76 77 |
# File 'lib/socket_proxy.rb', line 74 def add(svrsock, clntsock) @pool.push(Session.new(svrsock, clntsock)) @sockets.push(svrsock, clntsock) end |
#del(session) ⇒ Object
79 80 81 82 83 |
# File 'lib/socket_proxy.rb', line 79 def del(session) @pool.delete(session) @sockets.delete(session.server) @sockets.delete(session.client) end |
#each ⇒ Object
68 69 70 71 72 |
# File 'lib/socket_proxy.rb', line 68 def each @pool.each do |i| yield i end end |
#sockets ⇒ Object
64 65 66 |
# File 'lib/socket_proxy.rb', line 64 def sockets @sockets end |