I am trying to make a robust clientReader and am having problems in the 
case, where the client comes up before the server. See below for the 
important code. So if I start the client more than a second before than the 
server, the WaitForConnected deadline passes, and GetState() returns 
GRPC_CHANNEL_TRANSIENT_FAILURE, 
and subsequent calls of WaitForConnected() does not actually wait, and 
GetState gets stuck at GRPC_CHANNEL_CONNECTING, even after server finally 
does come up. So do I need to reset the channel, or what to get it to 
actually connect?

Thanks.



>
>     time_point deadline = std::chrono::system_clock::now() + 
> std::chrono::seconds(1);
>     while ((channel->GetState(true) != GRPC_CHANNEL_READY) && 
> meTasksRunning)
>     {
>       std::cout << tcDateTime::GetLogTimestamp() << " RunDataProductClient 
> : Connecting " << client->msDataProduct.c_str() << " State: " << 
> channel->GetState(false) << std::endl;
>       channel->WaitForConnected(deadline);
>       std::cout << tcDateTime::GetLogTimestamp() << " RunDataProductClient 
> : Connected " << client->msDataProduct.c_str() << " State: " << 
> channel->GetState(false) << std::endl;
>       
>
          // This was added, because  subsequent calls of WaitForConnected() 
does not actually wait

>       if (channel->GetState(true) != GRPC_CHANNEL_READY && meTasksRunning)
>       {
>         std::this_thread::sleep_for(std::chrono::seconds(1));
>       }
>     }



-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/3b4a621d-0b66-4a3c-8a9b-3459c64c80a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to