Class: Hop::WssBearer::SocketLease
- Inherits:
-
Object
- Object
- Hop::WssBearer::SocketLease
- Defined in:
- lib/hop/wss_bearer.rb
Instance Attribute Summary collapse
-
#sock ⇒ Object
readonly
Returns the value of attribute sock.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(admission, sock) ⇒ SocketLease
constructor
A new instance of SocketLease.
- #release ⇒ Object
- #replace(sock) ⇒ Object
Constructor Details
#initialize(admission, sock) ⇒ SocketLease
Returns a new instance of SocketLease.
217 218 219 220 221 222 |
# File 'lib/hop/wss_bearer.rb', line 217 def initialize(admission, sock) @admission = admission @sock = sock @lock = Mutex.new @released = false end |
Instance Attribute Details
#sock ⇒ Object (readonly)
Returns the value of attribute sock.
215 216 217 |
# File 'lib/hop/wss_bearer.rb', line 215 def sock @sock end |
Instance Method Details
#close ⇒ Object
238 |
# File 'lib/hop/wss_bearer.rb', line 238 def close = (@sock.close rescue nil) |
#release ⇒ Object
229 230 231 232 233 234 235 236 |
# File 'lib/hop/wss_bearer.rb', line 229 def release @lock.synchronize do return if @released @released = true @admission.release(self) end end |
#replace(sock) ⇒ Object
224 225 226 227 |
# File 'lib/hop/wss_bearer.rb', line 224 def replace(sock) @sock = sock @admission.replace(self, sock) end |