Class: SocketProxy::SessionPool

Inherits:
Object
  • Object
show all
Defined in:
lib/socket_proxy.rb

Defined Under Namespace

Classes: Session

Instance Method Summary collapse

Constructor Details

#initializeSessionPool

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

#eachObject



68
69
70
71
72
# File 'lib/socket_proxy.rb', line 68

def each
  @pool.each do |i|
	yield i
  end
end

#socketsObject



64
65
66
# File 'lib/socket_proxy.rb', line 64

def sockets
  @sockets
end