[Opensrf-commits] r1198 - trunk/src/libopensrf
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jan 3 17:52:38 EST 2008
Author: erickson
Date: 2008-01-03 17:28:52 -0500 (Thu, 03 Jan 2008)
New Revision: 1198
Modified:
trunk/src/libopensrf/osrf_prefork.c
Log:
removed assumption that settings values would be numbers. cleaned up the code some to make it more readable
Modified: trunk/src/libopensrf/osrf_prefork.c
===================================================================
--- trunk/src/libopensrf/osrf_prefork.c 2008-01-02 18:53:30 UTC (rev 1197)
+++ trunk/src/libopensrf/osrf_prefork.c 2008-01-03 22:28:52 UTC (rev 1198)
@@ -22,38 +22,31 @@
int maxr = 1000;
int maxc = 10;
int minc = 3;
+ int kalive = 5;
osrfLogInfo( OSRF_LOG_MARK, "Loading config in osrf_forker for app %s", appname);
- jsonObject* max_req = osrf_settings_host_value_object("/apps/%s/unix_config/max_requests", appname);
- jsonObject* min_children = osrf_settings_host_value_object("/apps/%s/unix_config/min_children", appname);
- jsonObject* max_children = osrf_settings_host_value_object("/apps/%s/unix_config/max_children", appname);
-
+ char* max_req = osrf_settings_host_value("/apps/%s/unix_config/max_requests", appname);
+ char* min_children = osrf_settings_host_value("/apps/%s/unix_config/min_children", appname);
+ char* max_children = osrf_settings_host_value("/apps/%s/unix_config/max_children", appname);
char* keepalive = osrf_settings_host_value("/apps/%s/keepalive", appname);
- time_t kalive;
- if( keepalive ) {
- kalive = atoi(keepalive);
- free(keepalive);
- } else {
- kalive = 5; /* give it a default */
- }
- osrfLogInfo(OSRF_LOG_MARK, "keepalive setting = %d seconds", kalive);
+ if(!keepalive) osrfLogWarning( OSRF_LOG_MARK, "Keepalive is not defined, assuming %d", kalive);
+ else kalive = atoi(keepalive);
+ if(!max_req) osrfLogWarning( OSRF_LOG_MARK, "Max requests not defined, assuming %d", maxr);
+ else maxr = atoi(max_req);
-
- if(!max_req) osrfLogWarning( OSRF_LOG_MARK, "Max requests not defined, assuming 1000");
- else maxr = (int) jsonObjectGetNumber(max_req);
+ if(!min_children) osrfLogWarning( OSRF_LOG_MARK, "Min children not defined, assuming %d", minc);
+ else minc = atoi(min_children);
- if(!min_children) osrfLogWarning( OSRF_LOG_MARK, "Min children not defined, assuming 3");
- else minc = (int) jsonObjectGetNumber(min_children);
+ if(!max_children) osrfLogWarning( OSRF_LOG_MARK, "Max children not defined, assuming %d", maxc);
+ else maxc = atoi(max_children);
- if(!max_children) osrfLogWarning( OSRF_LOG_MARK, "Max children not defined, assuming 10");
- else maxc = (int) jsonObjectGetNumber(max_children);
-
- jsonObjectFree(max_req);
- jsonObjectFree(min_children);
- jsonObjectFree(max_children);
+ free(keepalive);
+ free(max_req);
+ free(min_children);
+ free(max_children);
/* --------------------------------------------------- */
char* resc = va_list_to_string("%s_listener", appname);
More information about the opensrf-commits
mailing list