소스 검색

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;