- const char *str_writequeuelengthlimithigh = global_option_get ("WriteQueueLengthLimitHigh");
- const char *str_writequeuelengthlimitlow = global_option_get ("WriteQueueLengthLimitLow");
-
- writequeuelengthlimit_high = 0;
- writequeuelengthlimit_low = 0;
-
- if(NULL != str_writequeuelengthlimithigh) {
- errno = 0;
- /* get high limit */
- writequeuelengthlimit_high = strtol(str_writequeuelengthlimithigh, NULL, 10);
- if ((errno == ERANGE && (writequeuelengthlimit_high == LONG_MAX || writequeuelengthlimit_high == LONG_MIN))
- || (errno != 0 && writequeuelengthlimit_high == 0)
- ) {
- writequeuelengthlimit_high = 0;
- ERROR("Config 'WriteQueueLengthLimitHigh' accepts one integer value only. Running with no limit !");
- }
- if(writequeuelengthlimit_high < 0) {
- ERROR("Config 'WriteQueueLengthLimitHigh' accepts positive values only. Running with no limit !");
- writequeuelengthlimit_high = 0;
- }
- }
-
- if((writequeuelengthlimit_high > 0) && (NULL != str_writequeuelengthlimitlow)) {
- errno = 0;
- /* get low limit */
- writequeuelengthlimit_low = strtol(str_writequeuelengthlimitlow, NULL, 10);
- if ((errno == ERANGE && (writequeuelengthlimit_low == LONG_MAX || writequeuelengthlimit_low == LONG_MIN))
- || (errno != 0 && writequeuelengthlimit_low == 0)
- ) {
- writequeuelengthlimit_low = 0;
- ERROR("Config 'WriteQueueLengthLimitLow' accepts one integer value only. Using default low limit instead");
- }
-
- if(writequeuelengthlimit_low < 0) {
- ERROR("Config 'WriteQueueLengthLimitLow' accepts positive values only. Using default low limit instead");
- writequeuelengthlimit_low = 0;
- } else if(writequeuelengthlimit_low > writequeuelengthlimit_high) {
- ERROR("Config 'WriteQueueLengthLimitLow' (%ld) cannot be bigger than high limit (%ld). Using default low limit instead",
- writequeuelengthlimit_low, writequeuelengthlimit_high);
- writequeuelengthlimit_low = 0;
- }
- }
- /* Check/compute low limit if not/badly defined */
- if(writequeuelengthlimit_high > 0) {
- if(0 == writequeuelengthlimit_low) {
- writequeuelengthlimit_low = .5 * writequeuelengthlimit_high;
- }
- INFO("Config 'WriteQueueLengthLimit*' : Running with limits high=%ld low=%ld", writequeuelengthlimit_high, writequeuelengthlimit_low);
- random_seed = time(0);
- } else {
- writequeuelengthlimit_low = 0; /* This should be useless, but in case... */
- }