added timeout url param to set the request timeout
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 26 Jan 2007 20:24:37 +0000 (20:24 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 26 Jan 2007 20:24:37 +0000 (20:24 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@815 9efc2488-bf62-4759-914b-345cdb29e865

src/gateway/osrf_json_gateway.c

index 1e0f1b5..b9262e0 100644 (file)
@@ -114,6 +114,15 @@ static int osrf_json_gateway_method_handler (request_rec *r) {
        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);
 
@@ -198,7 +207,7 @@ static int osrf_json_gateway_method_handler (request_rec *r) {
                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;