Navigation


Changeset 253:ad6c0118fb50 in freeDiameter


Ignore:
Timestamp:
Apr 13, 2010, 2:50:54 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Configurable number of server threads

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • doc/freediameter.conf.sample

    r24 r253  
    144144# Default: Relaying is enabled.
    145145#NoRelay;
     146
     147# Number of server threads that can handle incoming messages at the same time.
     148#  TODO: implement dynamic # of threads depending on the length of the queue.
     149# Default: 4
     150#AppServThreads = 4;
    146151
    147152# Other applications are configured by loading appropriate extensions.
  • freeDiameter/config.c

    r189 r253  
    5959        fd_g_config->cnf_port_tls = 3869;
    6060        fd_g_config->cnf_sctp_str = 30;
     61        fd_g_config->cnf_dispthr  = 4;
    6162        fd_list_init(&fd_g_config->cnf_endpoints, NULL);
    6263        fd_list_init(&fd_g_config->cnf_apps, NULL);
     
    9293        fd_log_debug("  Local secure port ...... : %hu\n", fd_g_config->cnf_port_tls);
    9394        fd_log_debug("  Number of SCTP streams . : %hu\n", fd_g_config->cnf_sctp_str);
     95        fd_log_debug("  Number of server threads : %hu\n", fd_g_config->cnf_dispthr);
    9496        if (FD_IS_LIST_EMPTY(&fd_g_config->cnf_endpoints)) {
    9597                fd_log_debug("  Local endpoints ........ : Default (use all available)\n");
  • freeDiameter/fdd.l

    r18 r253  
    123123(?i:"TLS_old_method")   { return OLDTLS;        }
    124124(?i:"SCTP_streams")     { return SCTPSTREAMS;   }
     125(?i:"AppServThreads")   { return APPSERVTHREADS;}
    125126(?i:"ListenOn")         { return LISTENON;      }
    126127(?i:"TcTimer")          { return TCTIMER;       }
  • freeDiameter/fdd.y

    r142 r253  
    105105%token          NOTLS
    106106%token          SCTPSTREAMS
     107%token          APPSERVTHREADS
    107108%token          LISTENON
    108109%token          TCTIMER
     
    133134                        | conffile listenon
    134135                        | conffile norelay
     136                        | conffile appservthreads
    135137                        | conffile noip
    136138                        | conffile noip6
     
    231233                        ;
    232234
     235appservthreads:         APPSERVTHREADS '=' INTEGER ';'
     236                        {
     237                                CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1024),
     238                                        { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );
     239                                conf->cnf_dispthr = (uint16_t)$3;
     240                        }
     241                        ;
     242
    233243noip:                   NOIP ';'
    234244                        {
  • freeDiameter/main.c

    r236 r253  
    9696        CHECK_FCT(  fd_msg_init()  );
    9797        CHECK_FCT(  fd_p_expi_init()  );
    98         CHECK_FCT(  fd_rtdisp_init()  );
    9998       
    10099        /* Parse the configuration file */
    101100        CHECK_FCT( fd_conf_parse() );
     101       
     102        /* Create the daemon's threads */
     103        CHECK_FCT(  fd_rtdisp_init()  );
    102104       
    103105        /* Load the dynamic extensions */
  • freeDiameter/routing_dispatch.c

    r241 r253  
    10701070/********************************************************************************/
    10711071
     1072static pthread_t * dispatch = NULL;
     1073static enum thread_state * disp_state = NULL;
     1074
    10721075/* Later: make this more dynamic */
    1073 static pthread_t dispatch = (pthread_t)NULL;
    1074 static enum thread_state disp_state = INITIAL;
    1075 
    10761076static pthread_t rt_out = (pthread_t)NULL;
    10771077static enum thread_state out_state = INITIAL;
     
    10831083int fd_rtdisp_init(void)
    10841084{
    1085         CHECK_POSIX( pthread_create( &dispatch, NULL, dispatch_thr, &disp_state ) );
     1085        int i;
     1086       
     1087        /* Prepare the array for dispatch */
     1088        CHECK_MALLOC( dispatch = calloc(fd_g_config->cnf_dispthr, sizeof(pthread_t)) );
     1089        CHECK_MALLOC( disp_state = calloc(fd_g_config->cnf_dispthr, sizeof(enum thread_state)) );
     1090       
     1091        /* Create the threads */
     1092        for (i=0; i < fd_g_config->cnf_dispthr; i++) {
     1093                CHECK_POSIX( pthread_create( &dispatch[i], NULL, dispatch_thr, &disp_state[i] ) );
     1094        }
    10861095        CHECK_POSIX( pthread_create( &rt_out, NULL, routing_out_thr, &out_state) );
    10871096        CHECK_POSIX( pthread_create( &rt_in,  NULL, routing_in_thr,  &in_state) );
     
    11391148int fd_rtdisp_fini(void)
    11401149{
     1150        int i;
     1151       
    11411152        /* Destroy the incoming queue */
    11421153        CHECK_FCT_DO( fd_queues_fini(&fd_g_incoming), /* ignore */);
     
    11551166       
    11561167        /* Stop the Dispatch thread */
    1157         stop_thread_delayed(&disp_state, &dispatch, "Dispatching");
     1168        for (i=0; i < fd_g_config->cnf_dispthr; i++) {
     1169                stop_thread_delayed(&disp_state[i], &dispatch[i], "Dispatching");
     1170        }
    11581171       
    11591172        return 0;
  • include/freeDiameter/freeDiameter.h

    r214 r253  
    9191        struct fd_list   cnf_endpoints; /* the local endpoints to bind the server to. list of struct fd_endpoint. default is empty (bind all) */
    9292        struct fd_list   cnf_apps;      /* Applications locally supported (except relay, see flags). Use fd_disp_app_support to add one. list of struct fd_app. */
     93        uint16_t         cnf_dispthr;   /* Number of dispatch threads to create */
    9394        struct {
    9495                unsigned no_fwd : 1;    /* the peer does not relay messages (0xffffff app id) */
Note: See TracChangeset for help on using the changeset viewer.