| 730 | url_(strings::StrCat(DebugIO::kGrpcURLScheme, server_stream_addr)) {} |
| 731 | |
| 732 | Status DebugGrpcChannel::Connect(const int64 timeout_micros) { |
| 733 | ::grpc::ChannelArguments args; |
| 734 | args.SetInt(GRPC_ARG_MAX_MESSAGE_LENGTH, std::numeric_limits<int32>::max()); |
| 735 | // Avoid problems where default reconnect backoff is too long (e.g., 20 s). |
| 736 | args.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, 1000); |
| 737 | channel_ = ::grpc::CreateCustomChannel( |
| 738 | server_stream_addr_, ::grpc::InsecureChannelCredentials(), args); |
| 739 | if (!channel_->WaitForConnected( |
| 740 | gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
| 741 | gpr_time_from_micros(timeout_micros, GPR_TIMESPAN)))) { |
| 742 | return errors::FailedPrecondition( |
| 743 | "Failed to connect to gRPC channel at ", server_stream_addr_, |
| 744 | " within a timeout of ", timeout_micros / 1e6, " s."); |
| 745 | } |
| 746 | stub_ = EventListener::NewStub(channel_); |
| 747 | reader_writer_ = stub_->SendEvents(&ctx_); |
| 748 | |
| 749 | return Status::OK(); |
| 750 | } |
| 751 | |
| 752 | bool DebugGrpcChannel::WriteEvent(const Event& event) { |
| 753 | mutex_lock l(mu_); |
no test coverage detected