| 
					
				 | 
			
			
				@@ -562,9 +562,8 @@ exports.makeClientConstructor = function(methods, serviceName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * Wait for the client to be ready. The callback will be called when the 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * client has successfully connected to the server, and it will be called 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * with an error if the attempt to connect to the server has unrecoverablly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * failed or if the deadline expires. This function does not automatically 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * attempt to initiate the connection, so the callback will not be called 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * unless you also start a method call or call $tryConnect. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * failed or if the deadline expires. This function will make the channel 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * start connecting if it has not already done so. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @param {(Date|Number)} deadline When to stop waiting for a connection. Pass 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    *     Infinity to wait forever. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * @param {function(Error)} callback The callback to call when done attempting 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -572,12 +571,11 @@ exports.makeClientConstructor = function(methods, serviceName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   Client.prototype.$waitForReady = function(deadline, callback) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    var checkState = function(err, result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var checkState = function(err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (err) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         callback(new Error('Failed to connect before the deadline')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      var new_state = result.new_state; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      var new_state = this.channel.getConnectivityState(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if (new_state === grpc.connectivityState.READY) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         callback(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } else if (new_state === grpc.connectivityState.FATAL_FAILURE) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -586,17 +584,7 @@ exports.makeClientConstructor = function(methods, serviceName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         self.channel.watchConnectivityState(new_state, deadline, checkState); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    checkState(null, {new_state: this.channel.getConnectivityState()}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * Attempt to connect to the server. That will happen automatically if 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * you try to make a method call with this client, so this function should 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * only be used if you want to know that you have a connection before making 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   * any calls. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  Client.prototype.$tryConnect = function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.channel.getConnectivityState(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    checkState(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   _.each(methods, function(attrs, name) { 
			 |