Navigation


Changeset 1078:74bba7975864 in freeDiameter for freeDiameterd


Ignore:
Timestamp:
Apr 30, 2013, 4:37:57 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Cleanup the timing data and fd_msg_log feature that will be replaced by the new hooks mechanism. Kept the calls to fd_msg_log in comments to find the locations easily. WORK IN PROGRESS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameterd/main.c

    r931 r1078  
    4949static char *conffile = NULL;
    5050static int gnutls_debug = 0;
    51 static int fd_msg_log_enabled = 0; /* all logs disabled by default, this field is a bitfield of enabled FD_MSG_LOG_* */
    5251
    5352/* gnutls debug */
     
    8887        }
    8988       
    90         /* set messages logging */
    91         if (fd_msg_log_enabled) {
    92                 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_DROPPED)) {
    93                         CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_DROPPED, FD_MSG_LOGTO_DEBUGONLY, NULL) );
    94                 }
    95                 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_RECEIVED)) {
    96                         CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_RECEIVED, FD_MSG_LOGTO_DEBUGONLY, NULL) );
    97                 }
    98                 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_SENT)) {
    99                         CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_SENT, FD_MSG_LOGTO_DEBUGONLY, NULL) );
    100                 }
    101                 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_NODELIVER)) {
    102                         CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_NODELIVER, FD_MSG_LOGTO_DEBUGONLY, NULL) );
    103                 }
    104                 if (fd_msg_log_enabled & (1 << FD_MSG_LOG_TIMING)) {
    105                         CHECK_FCT( fd_msg_log_config(FD_MSG_LOG_TIMING, FD_MSG_LOGTO_DEBUGONLY, NULL) );
    106                 }
    107         }
    108                
    10989        /* Allow SIGINT and SIGTERM from this point to terminate the application */
    11090        CHECK_POSIX( pthread_create(&signals_thr, NULL, catch_signals, NULL) );
     
    169149                "  -V, --version          Print version and exit\n"
    170150                "  -c, --config=filename  Read configuration from this file instead of the \n"
    171                 "                           default location (" DEFAULT_CONF_PATH "/" FD_DEFAULT_CONF_FILENAME ").\n"
    172                 "  -M, --enable_msg_log=( DROPPED | RECEIVED | SENT | NODELIVER | TIMING )\n"
    173                 "                         Enable logging of these messages in the output.\n");
     151                "                           default location (" DEFAULT_CONF_PATH "/" FD_DEFAULT_CONF_FILENAME ").\n");
    174152        printf( "\nDebug:\n"
    175153                "  These options are mostly useful for developers\n"
     
    197175                { "dbg_file",   required_argument,      NULL, 'F' },
    198176                { "dbg_gnutls", required_argument,      NULL, 'g' },
    199                 { "enable_msg_log",     optional_argument,      NULL, 'M' },
    200177                { NULL,         0,                      NULL, 0 }
    201178        };
     
    232209                                break;
    233210                               
    234                         case 'M':       /* disable logging of these messages */
    235                                 if (optarg) {
    236                                         if (!strcmp(optarg, "DROPPED")) {
    237                                                 fd_msg_log_enabled |= 1 << FD_MSG_LOG_DROPPED;
    238                                         } else
    239                                         if (!strcmp(optarg, "RECEIVED")) {
    240                                                 fd_msg_log_enabled |= 1 << FD_MSG_LOG_RECEIVED;
    241                                         } else
    242                                         if (!strcmp(optarg, "SENT")) {
    243                                                 fd_msg_log_enabled |= 1 << FD_MSG_LOG_SENT;
    244                                         } else
    245                                         if (!strcmp(optarg, "NODELIVER")) {
    246                                                 fd_msg_log_enabled |= 1 << FD_MSG_LOG_NODELIVER;
    247                                         } else
    248                                         if (!strcmp(optarg, "TIMING")) {
    249                                                 fd_msg_log_enabled |= 1 << FD_MSG_LOG_TIMING;
    250                                         } else {
    251                                                 main_help();
    252                                                 exit(0);
    253                                         }
    254                                 } else {
    255                                         fd_msg_log_enabled = -1; /* all logs enabled */
    256                                 }
    257 
    258211                        case 'd':       /* Increase verbosity of debug messages.  */
    259212                                fd_g_debug_lvl++;
Note: See TracChangeset for help on using the changeset viewer.