mirror of https://github.com/grpc/grpc-node.git
				
				
				
			
							parent
							
								
									b3d05a3859
								
							
						
					
					
						commit
						db291906fa
					
				| 
						 | 
					@ -270,6 +270,10 @@ NAN_METHOD(Channel::GetTarget) {
 | 
				
			||||||
        "getTarget can only be called on Channel objects");
 | 
					        "getTarget can only be called on Channel objects");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
 | 
					  Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
 | 
				
			||||||
 | 
					  if (channel->wrapped_channel == NULL) {
 | 
				
			||||||
 | 
					    return Nan::ThrowError(
 | 
				
			||||||
 | 
					        "Cannot call getTarget on a closed Channel");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  info.GetReturnValue().Set(
 | 
					  info.GetReturnValue().Set(
 | 
				
			||||||
      Nan::New(grpc_channel_get_target(channel->wrapped_channel))
 | 
					      Nan::New(grpc_channel_get_target(channel->wrapped_channel))
 | 
				
			||||||
          .ToLocalChecked());
 | 
					          .ToLocalChecked());
 | 
				
			||||||
| 
						 | 
					@ -281,6 +285,10 @@ NAN_METHOD(Channel::GetConnectivityState) {
 | 
				
			||||||
        "getConnectivityState can only be called on Channel objects");
 | 
					        "getConnectivityState can only be called on Channel objects");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
 | 
					  Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
 | 
				
			||||||
 | 
					  if (channel->wrapped_channel == NULL) {
 | 
				
			||||||
 | 
					    return Nan::ThrowError(
 | 
				
			||||||
 | 
					        "Cannot call getConnectivityState on a closed Channel");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  int try_to_connect = (int)info[0]->Equals(Nan::True());
 | 
					  int try_to_connect = (int)info[0]->Equals(Nan::True());
 | 
				
			||||||
  info.GetReturnValue().Set(grpc_channel_check_connectivity_state(
 | 
					  info.GetReturnValue().Set(grpc_channel_check_connectivity_state(
 | 
				
			||||||
      channel->wrapped_channel, try_to_connect));
 | 
					      channel->wrapped_channel, try_to_connect));
 | 
				
			||||||
| 
						 | 
					@ -303,12 +311,16 @@ NAN_METHOD(Channel::WatchConnectivityState) {
 | 
				
			||||||
    return Nan::ThrowTypeError(
 | 
					    return Nan::ThrowTypeError(
 | 
				
			||||||
        "watchConnectivityState's third argument must be a callback");
 | 
					        "watchConnectivityState's third argument must be a callback");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
 | 
				
			||||||
 | 
					  if (channel->wrapped_channel == NULL) {
 | 
				
			||||||
 | 
					    return Nan::ThrowError(
 | 
				
			||||||
 | 
					        "Cannot call watchConnectivityState on a closed Channel");
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  grpc_connectivity_state last_state = static_cast<grpc_connectivity_state>(
 | 
					  grpc_connectivity_state last_state = static_cast<grpc_connectivity_state>(
 | 
				
			||||||
      Nan::To<uint32_t>(info[0]).FromJust());
 | 
					      Nan::To<uint32_t>(info[0]).FromJust());
 | 
				
			||||||
  double deadline = Nan::To<double>(info[1]).FromJust();
 | 
					  double deadline = Nan::To<double>(info[1]).FromJust();
 | 
				
			||||||
  Local<Function> callback_func = info[2].As<Function>();
 | 
					  Local<Function> callback_func = info[2].As<Function>();
 | 
				
			||||||
  Nan::Callback *callback = new Callback(callback_func);
 | 
					  Nan::Callback *callback = new Callback(callback_func);
 | 
				
			||||||
  Channel *channel = ObjectWrap::Unwrap<Channel>(info.This());
 | 
					 | 
				
			||||||
  unique_ptr<OpVec> ops(new OpVec());
 | 
					  unique_ptr<OpVec> ops(new OpVec());
 | 
				
			||||||
  grpc_channel_watch_connectivity_state(
 | 
					  grpc_channel_watch_connectivity_state(
 | 
				
			||||||
      channel->wrapped_channel, last_state, MillisecondsToTimespec(deadline),
 | 
					      channel->wrapped_channel, last_state, MillisecondsToTimespec(deadline),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue