a_l = apacheGetFirstParamValue( params, "api_level" );
mparams = apacheGetParamValues( params, "param" ); /* free me */
+ /* set the user defined timeout value */
+ int timeout = 60;
+ char* tout = apacheGetFirstParamValue( params, "timeout" ); /* request timeout in seconds */
+ if( tout ) {
+ timeout = atoi(tout);
+ osrfLogDebug(OSRF_LOG_MARK, "Client supplied timeout of %d", timeout);
+ }
+
+
if (a_l)
api_level = atoi(a_l);
fflush(stderr);
*/
+ osrfAppSession* session = osrf_app_client_session_init(service);
+
+ double starttime = get_timestamp_millis();
+ int req_id = osrf_app_session_make_req( session, NULL, method, api_level, mparams );
+
+
+ if( req_id == -1 ) {
+ osrfLogError(OSRF_LOG_MARK, "I am unable to communcate with opensrf..going away...");
+ /* we don't want to spawn an intense re-forking storm
+ * if there is no jabber server.. so give it some time before we die */
+ usleep( 100000 ); /* 100 milliseconds */
+ exit(1);
+ }
+
/* ----------------------------------------------------------------- */
/* log all requests to the activity log */
buffer_free(act);
/* ----------------------------------------------------------------- */
- osrfAppSession* session = osrf_app_client_session_init(service);
-
- double starttime = get_timestamp_millis();
- int req_id = osrf_app_session_make_req( session, NULL, method, api_level, mparams );
-
-
- if( req_id == -1 ) {
- osrfLogError(OSRF_LOG_MARK, "I am unable to communcate with opensrf..going away...");
- /* we don't want to spawn an intense re-forking storm
- * if there is no jabber server.. so give it some time before we die */
- usleep( 100000 ); /* 100 milliseconds */
- exit(1);
- }
osrf_message* omsg = NULL;
char* statustext = NULL;
char* output = NULL;
- while((omsg = osrfAppSessionRequestRecv( session, req_id, 60 ))) {
+ while((omsg = osrfAppSessionRequestRecv( session, req_id, timeout ))) {
statuscode = omsg->status_code;
jsonObject* res;
string_array_destroy(mparams);
osrfLogDebug(OSRF_LOG_MARK, "Gateway served %d requests", ++numserved);
+ osrfLogClearXid();
return ret;
}