Changeset 1548

Show
Ignore:
Timestamp:
06/13/08 21:03:54 (4 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/branches/0.7

    • Property svnmerge-integrated changed from /cherokee/trunk:1-1456,1460,1463,1465,1468,1482,1484,1486,1501,1532,1534-1535,1545 to /cherokee/trunk:1-1456,1460,1463,1465,1468,1482,1484,1486,1501,1532,1534-1535,1545,1547
  • cherokee/branches/0.7/ChangeLog

    r1546 r1548  
    112008-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. 
    25 
    36        * cherokee/main_guardian.c (save_pid_file): Bug fix: Do not try to 
  • cherokee/branches/0.7/cherokee/main_guardian.c

    r1546 r1548  
    3434#endif 
    3535 
    36 #define ERROR_DELAY       3000 * 1000 
    37 #define RESTARTING_DELAY   500 * 1000 
     36#define DELAY_ERROR       3000 * 1000 
     37#define DELAY_RESTARTING   500 * 1000 
    3838#define PID_FILE          CHEROKEE_VAR_RUN "/cherokee-guardian.pid" 
    3939 
     
    184184} 
    185185 
     186static cherokee_boolean_t 
     187is_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} 
    186201 
    187202int 
    188203main (int argc, char *argv[]) 
    189204{ 
    190         ret_t ret; 
     205        ret_t              ret; 
     206        cherokee_boolean_t single_time; 
    191207 
    192208        set_guardian_signals();     
    193  
    194         while (! exit_guardian) { 
     209        single_time = is_single_execution (argc, argv); 
     210 
     211        do { 
    195212                pid = process_launch (CHEROKEE_SRV_PATH, argc, argv); 
    196213                if (pid < 0) { 
     
    198215                        exit (1); 
    199216                } 
     217 
     218                if (! single_time)  
     219                        save_pid_file(pid); 
     220 
     221                ret = process_wait (pid); 
    200222                 
    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); 
    206230 
    207231        return 0;