Hi Michael, Were you able to find any other way to cancel the stream from client side?
On Tuesday, May 26, 2015 at 9:58:42 PM UTC+5:30, Michael Larson wrote: > > a tentative answer to my question: > > You can call TryCancel() on the client context from another thread. I > started a "connection monitor" thread just before creating the stream > object (the point at which the code would normally hang until the grpc > deadline). With some external synchronization this thread can know whether > the stream has received any data within N seconds and call TryCancel() if > it hasn't. I am not using the grpc deadline (it is set to its default, a > very long time) and am watching received messages to implement my own > timeout while the stream is running. > > Please let me know if there is a better or more intended way to do this. > > Thanks, > > Michael > > On Friday, May 22, 2015 at 3:29:55 PM UTC-7, Michael Larson wrote: >> >> see this thread for some related discussion (java): >> https://groups.google.com/forum/#!msg/grpc-io/hahFSzQBN4s/nrifoZ0tATUJ >> >> 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). >> > -- 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/73eab4e1-0c6e-4b06-ba5e-eab555310be1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.