static void _on_response( void* context, int res_status, TtsSynthResponseData* response_data ) { TtsProviderRequest *provider_request = (TtsProviderRequest*) context; unsigned int delta = roadmap_time_get_millis() - provider_request->start_time; int matched_count; roadmap_log( ROADMAP_DEBUG, TTS_LOG_STR( "Request was completed in %d ms. Status: %d" ), delta, res_status ); if ( res_status == TTS_RES_STATUS_SUCCESS ) { // Call the process received one more time - for sure ( if progress was not called for the last chunk ) matched_count = _process_received( provider_request, response_data ); roadmap_log( ROADMAP_DEBUG, TTS_LOG_STR( "Received %d elements in tts response. Matched: %d. Requested: %d" ), response_data->count, matched_count, provider_request->idx_list_count ); } else { roadmap_log( ROADMAP_ERROR, TTS_LOG_STR( "Error in response" ) ); _process_error( provider_request ); } // Deallocate the context _provider_ctx_free( provider_request ); sgActiveRequestsCount--; // Commit the remaining entries in the queue if existing tts_commit(); }
static void _process_error_or_timeout(int loc, int err, time_t tdiff) { if (err < 0) { if (err != GNUTLS_E_TIMEDOUT || tdiff >= 60) { _process_error(loc, err, 0); } else { fprintf(stdout, "%i %s| line %i: {spurious timeout} (fatal)", run_id, role_name, loc); exit(1); } } }