浏览代码

added method Peer.isConnected()

Matthias Lohr 12 年之前
父节点
当前提交
bf4e695077
共有 1 个文件被更改,包括 8 次插入0 次删除
  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;