Permalink
Browse files

Update master

  • Loading branch information...
vincent-zhao committed Jul 12, 2012
1 parent a052d24 commit f0870c26b9b9054ee8ce8de57c65d861ff0ac374
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/zookeeper.js
View
@@ -210,6 +210,17 @@ ZooKeeper.prototype.connect = function connect(options, cb) {
self.on('error', errorHandler);
self.on('connect', connectHandler);
+ if (options.timeout) {
+ setTimeout(function() {
+ self.a_get('/', false, function(rc, error, stat, data) {
+ if (rc != 0) {
+ self.close();
+ cb(error);
+ }
+ });
+ }, options.timeout);
+ }
+
}
ZooKeeper.prototype.close = function close() {

0 comments on commit f0870c2

Please sign in to comment.