void SetContextDeadline(grpc::ClientContext *context, unsigned int user_defined_deadline){ context->set_deadline(std::chrono::system_clock::now() + std::chrono::seconds(user_defined_deadline));}
int main(){
auto creds = grpc::GoogleDefaultCredentials(); auto channel = grpc::CreateChannel("speech.googleapis.com", creds);
std::unique_ptr<Speech::Stub> speech(Speech::NewStub(channel));
grpc::ClientContext context;
// Set timeout of 8 seconds => also this is the timeout which I am not able to cancel to set new timer
// Whenever it ends (after 8 seconds) my program is terminated
SetContextDeadline(&context,8);
auto streamer = speech->StreamingRecognize(&context);
// The microphone thread writes the audio content. std::thread microphone_thread(&MicrophoneThreadMain, streamer.get(), file_path);
// Read responses. StreamingRecognizeResponse response; while (streamer->Read(&response)) { // Returns false when no more to read.
// Now I want to cancel the previous deadline to set this new deadline, everytime I enter this loop
// I am seeing that this is setting the new deadline but the program still terminates at the older timeout
SetContextDeadline(&context,8);
// Dump the transcript of all the results.
// Implementation of response display }}
--
Matrix Comsec Pvt. Ltd. #394, GIDC Makarpura - 390010. Dist: Vadodara, Gujarat, India IP Video Surveillance | People Mobility Management | Unified Communications 1 Million+ Customers | 2,500+ Partners | 60+ Products | 50+ Countries We put more in the box, so your business can think more out of the box.
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+u...@googlegroups.com.
To post to this group, send email to grp...@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/d8e3fbb2-ef13-4c97-8ed3-57c1c58486c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.
To post to this group, send email to grp...@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/d8e3fbb2-ef13-4c97-8ed3-57c1c58486c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--Thanks,
Sidhartha Thota.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@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/5cfd3c40-19fe-40c5-967e-0f5ca12c68bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.