Explorar o código

added method Peer.isConnected()

Matthias Lohr %!s(int64=12) %!d(string=hai) anos
pai
achega
bf4e695077
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  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;