Navigation


Changeset 1182:cc96a4dfb3d1 in freeDiameter for freeDiameterd


Ignore:
Timestamp:
Jun 6, 2013, 12:25:23 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Early shutdown situation: detect the race condition and delay the shutdown in freeDiameterd. Alternative would be to initialize in a separate thread that we can cancel before calling shutdown.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameterd/main.c

    r1159 r1182  
    8787        }
    8888       
     89        /* Parse the configuration file */
     90        CHECK_FCT_DO( fd_core_parseconf(conffile), goto error );
     91       
     92        /* Start the servers */
     93        CHECK_FCT_DO( fd_core_start(), goto error );
     94       
    8995        /* Allow SIGINT and SIGTERM from this point to terminate the application */
    90         CHECK_POSIX( pthread_create(&signals_thr, NULL, catch_signals, NULL) );
    91        
    92         /* Parse the configuration file */
    93         CHECK_FCT( fd_core_parseconf(conffile) );
    94        
    95         /* Start the servers */
    96         CHECK_FCT( fd_core_start() );
     96        CHECK_POSIX_DO( pthread_create(&signals_thr, NULL, catch_signals, NULL), goto error );
    9797       
    9898        TRACE_DEBUG(INFO, FD_PROJECT_BINARY " daemon initialized.");
    99        
     99
    100100        /* Now, just wait for termination */
    101101        CHECK_FCT( fd_core_wait_shutdown_complete() );
     
    105105       
    106106        return 0;
     107error: 
     108        CHECK_FCT_DO( fd_core_shutdown(),  );
     109        CHECK_FCT( fd_core_wait_shutdown_complete() );
     110        fd_thr_term(&signals_thr);
     111        return -1;
    107112}
    108113
Note: See TracChangeset for help on using the changeset viewer.