--- parser3/src/main/pa_request.C 2017/01/13 13:50:28 1.370 +++ parser3/src/main/pa_request.C 2017/01/29 19:41:17 1.372 @@ -7,6 +7,7 @@ #include "pa_sapi.h" #include "pa_common.h" +#include "pa_os.h" #include "pa_request.h" #include "pa_wwrapper.h" #include "pa_vclass.h" @@ -32,7 +33,7 @@ #include "pa_vconsole.h" #include "pa_vdate.h" -volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.370 2017/01/13 13:50:28 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; +volatile const char * IDENT_PA_REQUEST_C="$Id: pa_request.C,v 1.372 2017/01/29 19:41:17 moko Exp $" IDENT_PA_REQUEST_H IDENT_PA_REQUEST_CHARSETS_H IDENT_PA_REQUEST_INFO_H IDENT_PA_VCONSOLE_H; // consts @@ -89,6 +90,7 @@ size_t pa_file_size_limit=FILE_SIZE_LIMI #define LOOP_LIMIT_NAME "max_loop" #define RECOURSION_LIMIT_NAME "max_recoursion" #define FILE_SIZE_LIMIT_NAME "max_file_size" +#define FILE_LOCK_WAIT_LIMIT_NAME "max_file_lock_wait" #define CONF_METHOD_NAME "conf" #define POST_PROCESS_METHOD_NAME "postprocess" #define CLASS_PATH_NAME "CLASS_PATH" @@ -108,6 +110,7 @@ static const String limits_name(LIMITS_N static const String loop_limit_name(LOOP_LIMIT_NAME); static const String recoursion_limit_name(RECOURSION_LIMIT_NAME); static const String file_size_limit_name(FILE_SIZE_LIMIT_NAME); +static const String file_lock_wait_limit_name(FILE_LOCK_WAIT_LIMIT_NAME); static const String conf_method_name(CONF_METHOD_NAME); static const String post_process_method_name(POST_PROCESS_METHOD_NAME); @@ -145,8 +148,8 @@ Request::Request(SAPI_Info& asapi_info, wcontext(0), flang(adefault_lang), fconnection(0), - fskip(SKIP_NOTHING), fin_cycle(0), + fskip(SKIP_NOTHING), // public request_info(arequest_info), @@ -319,6 +322,18 @@ void Request::configure_admin(VStateless throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":LIMITS." FILE_SIZE_LIMIT_NAME " must be number"); } + pa_lock_attempts=PA_LOCK_ATTEMPTS; + if(limits) + if(Value* file_lock_wait_limit=limits->get_element(file_lock_wait_limit_name)) { + if(file_lock_wait_limit->is_evaluated_expr()) { + double limit=file_lock_wait_limit->as_double(); + if(limit >= 3600*24) + throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":LIMITS." FILE_LOCK_WAIT_LIMIT_NAME " must be less then %d", 3600*24); + pa_lock_attempts=(unsigned int)(limit*2)+1; + } else + throw Exception(PARSER_RUNTIME, 0, "$" MAIN_CLASS_NAME ":LIMITS." FILE_LOCK_WAIT_LIMIT_NAME " must be number"); + } + // configure method_frame options // until someone with less privileges have overriden them methoded_array().configure_admin(*this);