Parcourir la source

added method Peer.isConnected()

Matthias Lohr il y a 12 ans
Parent
commit
bf4e695077
1 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 8 0
      lib/peer.js

+ 8 - 0
lib/peer.js

@@ -301,5 +301,13 @@ Peer.prototype.disconnect = function() {
   }
 };
 
+/**
+ * Provides a clean method for checking if there's an active connection to the
+ * peer server.
+ */
+Peer.prototype.isConnected = function() {
+  return (!this.disconnected);
+}
+
 
 exports.Peer = Peer;