Changeset 1547
- Timestamp:
- 06/13/08 21:01:36 (4 months ago)
- Files:
-
- cherokee/trunk/ChangeLog (modified) (1 diff)
- cherokee/trunk/cherokee/main_guardian.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/ChangeLog
r1545 r1547 1 1 2008-06-13 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 3 * cherokee/main_guardian.c: Do not loop when the operation is 4 meant to happen a single time. Reported by Gunnar Wolf. 2 5 3 6 * cherokee/main_guardian.c (save_pid_file): Bug fix: Do not try to cherokee/trunk/cherokee/main_guardian.c
r1545 r1547 34 34 #endif 35 35 36 #define ERROR_DELAY3000 * 100037 #define RESTARTING_DELAY500 * 100036 #define DELAY_ERROR 3000 * 1000 37 #define DELAY_RESTARTING 500 * 1000 38 38 #define PID_FILE CHEROKEE_VAR_RUN "/cherokee-guardian.pid" 39 39 … … 184 184 } 185 185 186 static cherokee_boolean_t 187 is_single_execution (int argc, char *argv[]) 188 { 189 int i; 190 191 for (i=0; i<argc; i++) { 192 if (!strcmp (argv[i], "-t") || !strcmp (argv[i], "--test") || 193 !strcmp (argv[i], "-h") || !strcmp (argv[i], "--help") || 194 !strcmp (argv[i], "-V") || !strcmp (argv[i], "--version") || 195 !strcmp (argv[i], "-i") || !strcmp (argv[i], "--print-server-info")) 196 return true; 197 } 198 199 return false; 200 } 186 201 187 202 int 188 203 main (int argc, char *argv[]) 189 204 { 190 ret_t ret; 205 ret_t ret; 206 cherokee_boolean_t single_time; 191 207 192 208 set_guardian_signals(); 193 194 while (! exit_guardian) { 209 single_time = is_single_execution (argc, argv); 210 211 do { 195 212 pid = process_launch (CHEROKEE_SRV_PATH, argc, argv); 196 213 if (pid < 0) { … … 198 215 exit (1); 199 216 } 217 218 if (! single_time) 219 save_pid_file(pid); 220 221 ret = process_wait (pid); 200 222 201 save_pid_file(pid); 202 203 ret = process_wait (pid); 204 usleep ((ret == ret_ok) ? RESTARTING_DELAY : ERROR_DELAY); 205 } 223 if (single_time) 224 break; 225 226 usleep ((ret == ret_ok) ? 227 DELAY_RESTARTING : 228 DELAY_ERROR); 229 } while (! exit_guardian); 206 230 207 231 return 0;