Permalink
Browse files

Add Connection#connected? method

  • Loading branch information...
1 parent 8c6fc39 commit 024014c963ce2654fae9da322a74e0ec812d616e @mloughran mloughran committed Sep 9, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/em-jack/connection.rb
@@ -246,10 +246,12 @@ def connected
@reconnect_proc = nil
@retries = 0
succeed
+ @connected = true
@connected_callback.call if @connected_callback
end
def disconnected
+ @connected = false
d = @deferrables.dup
## if reconnecting, need to fail ourself to remove any callbacks
@@ -321,6 +323,10 @@ def on_connect(&blk)
@connected_callback = blk
end
+ def connected?
+ @connected
+ end
+
def received(data)
@data << data

0 comments on commit 024014c

Please sign in to comment.