see this thread for some related discussion (java):
I want to create a bidirectional streaming connection that runs for, say, 60 seconds, and I'd like to have it fail if it can't connect within 5 seconds, allowing the user to fix connection details or whatever. If I set a grpc deadline it has to apply to the entire RPC, so I'd need to set a timeout of more than 60 seconds to avoid interrupting the normal streaming duration. Without a deadline set it will attempt to connect forever.
Is there a way to cancel the connection attempt while it's running, before it has connected? I ran stub_.reset() from another thread but it didn't do anything immediately. grpc_shutdown() seems harmful as it had a mutex problem later on (and I see this was removed from the examples as no longer necessary).