Navigation


Changeset 1078:74bba7975864 in freeDiameter for libfdcore


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.

Location:
libfdcore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/cnxctx.c

    r1029 r1078  
    644644        }
    645645       
    646         CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &conn->cc_tls_para.recvon), /* continue */ );
    647        
    648646        return ret;
    649647}
     
    701699                ssize_t ret = 0;
    702700                size_t  received = 0;
    703                 struct timespec recv_on;
    704701
    705702                do {
     
    738735                        received += ret;
    739736                }
    740                
    741                 /* Piggy-tail the timestamp of reception */
    742                 CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &recv_on), /* continue */ );
    743                 memcpy(newmsg + length, &recv_on, sizeof(struct timespec));
    744737               
    745738                /* We have received a complete message, pass it to the daemon */
     
    930923int fd_tls_rcvthr_core(struct cnxctx * conn, gnutls_session_t session)
    931924{
    932         struct timespec * rcv_on = &conn->cc_tls_para.recvon;
    933        
    934925#ifndef DISABLE_SCTP
    935926        void * ptr = gnutls_transport_get_ptr(session);
    936927        if (ptr != conn) {
    937928                struct sctps_ctx * ctx = (struct sctps_ctx *) ptr;
    938                 rcv_on = &ctx->recvon;
    939929        }
    940930#endif /* DISABLE_SCTP */
     
    984974                        received += ret;
    985975                }
    986                
    987                 /* The timestamp of the last TLS chunk received for this rebuilt message lives close to the session pointer, we piggyback it */
    988                 memcpy(newmsg + length, rcv_on, sizeof(struct timespec));
    989976               
    990977                /* We have received a complete message, pass it to the daemon */
  • libfdcore/core.c

    r1034 r1078  
    209209        CHECK_FCT( fd_conf_init() );
    210210       
    211         /* Initialize the message logging facility */
    212         fd_msg_log_init(fd_g_config->cnf_dict);
    213 
    214211        /* Add definitions of the base protocol */
    215212        CHECK_FCT( fd_dict_base_protocol(fd_g_config->cnf_dict) );
  • libfdcore/messages.c

    r1014 r1078  
    415415               
    416416                /* Just discard */
    417                 fd_msg_log( FD_MSG_LOG_DROPPED, m, "Answer not compliant to dictionary's ABNF (%s)", pei.pei_errcode  );
     417                //fd_msg_log( FD_MSG_LOG_DROPPED, m, "Answer not compliant to dictionary's ABNF (%s)", pei.pei_errcode  );
    418418                CHECK_FCT( fd_msg_free( m ) );
    419419                *msg = NULL;
  • libfdcore/p_ce.c

    r1027 r1078  
    650650        *recv_cnx = NULL;
    651651        if (*cer) {
    652                 fd_msg_log(FD_MSG_LOG_DROPPED, *cer, "An error occurred while rejecting a CER.");
     652                //fd_msg_log(FD_MSG_LOG_DROPPED, *cer, "An error occurred while rejecting a CER.");
    653653                fd_msg_free(*cer);
    654654                *cer = NULL;
     
    720720        if (req || ((st = fd_peer_getstate(peer)) != STATE_WAITCEA)) {
    721721                if (*msg) {
    722                         fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Received CER/CEA while in '%s' state.", STATE_STR(st));
     722                        //fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Received CER/CEA while in '%s' state.", STATE_STR(st));
    723723                        CHECK_FCT_DO( fd_msg_free(*msg), /* continue */);
    724724                        *msg = NULL;
     
    987987cleanup:
    988988        if (msg) {
    989                 fd_msg_log(FD_MSG_LOG_DROPPED, msg, "An error occurred while processing a CER.");
     989                //fd_msg_log(FD_MSG_LOG_DROPPED, msg, "An error occurred while processing a CER.");
    990990                fd_msg_free(msg);
    991991        }
  • libfdcore/p_out.c

    r1027 r1078  
    4545        int ret;
    4646        uint32_t bkp_hbh = 0;
    47         struct timespec senton;
    4847        struct msg * cpy_for_logs_only;
    4948       
     
    7372        }
    7473       
    75         CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &senton), /* ... */ );
    76         CHECK_FCT_DO( fd_msg_ts_set_sent(cpy_for_logs_only, &senton), /* ... */ );
    77        
    7874        /* Log the message */
    79         fd_msg_log( FD_MSG_LOG_SENT, cpy_for_logs_only, "Sent to '%s'", fd_cnx_getid(cnx));
    80        
    81         {
    82                 struct timespec rcvon, delay;
    83                
    84                 (void) fd_msg_ts_get_recv(cpy_for_logs_only, &rcvon);
    85                 if (rcvon.tv_sec != 0 || rcvon.tv_nsec != 0) {
    86                         TS_DIFFERENCE( &delay, &rcvon, &senton);
    87                         fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Forwarded in %ld.%6.6ld sec", (long)delay.tv_sec, delay.tv_nsec/1000);
    88                 } else { /* We log the answer time only for answers generated locally */
    89                         if (!msg_is_a_req) {
    90                                 /* get the matching request */
    91                                 struct msg * req;
    92                                 struct timespec reqrcvon;
    93                                 (void) fd_msg_answ_getq(cpy_for_logs_only, &req);
    94                                 (void) fd_msg_ts_get_recv(req, &reqrcvon);
    95                                 TS_DIFFERENCE( &delay, &reqrcvon, &senton);
    96                                 fd_msg_log( FD_MSG_LOG_TIMING, cpy_for_logs_only, "Answered in %ld.%6.6ld sec", (long)delay.tv_sec, delay.tv_nsec/1000);
    97                         }
    98                 }
    99         }
     75        // fd_msg_log( FD_MSG_LOG_SENT, cpy_for_logs_only, "Sent to '%s'", fd_cnx_getid(cnx));
    10076       
    10177        /* Send the message */
     
    12298        CHECK_FCT_DO(fd_fifo_post(fd_g_outgoing, &msg),
    12399                {
    124                         fd_msg_log( FD_MSG_LOG_DROPPED, msg, "An error occurred while attempting to requeue this message during cancellation of the sending function");
     100                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "An error occurred while attempting to requeue this message during cancellation of the sending function");
    125101                        CHECK_FCT_DO(fd_msg_free(msg), /* What can we do more? */);
    126102                } );
     
    155131                        {
    156132                                if (msg) {
    157                                         fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)", strerror(ret) );
     133                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)", strerror(ret) );
    158134                                        fd_msg_free(msg);
    159135                                }
     
    207183                        {
    208184                                if (msg) {
    209                                         fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Problem while sending (%s)", strerror(ret) );
     185                                        //fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Problem while sending (%s)", strerror(ret) );
    210186                                        fd_msg_free(*msg);
    211187                                        *msg = NULL;
  • libfdcore/p_psm.c

    r1033 r1078  
    241241                        case FDEVP_CNX_INCOMING: {
    242242                                struct cnx_incoming * evd = ev->data;
    243                                 fd_msg_log( FD_MSG_LOG_DROPPED, evd->cer, "Message discarded while cleaning peer state machine queue." );
     243                                //fd_msg_log( FD_MSG_LOG_DROPPED, evd->cer, "Message discarded while cleaning peer state machine queue." );
    244244                                CHECK_FCT_DO( fd_msg_free(evd->cer), /* continue */);
    245245                                fd_cnx_destroy(evd->cnx);
     
    489489                struct msg * msg = NULL;
    490490                struct msg_hdr * hdr;
    491                 struct timespec rcvon;
    492                
    493                 /* Retrieve the piggytailed timestamp */
    494                 memcpy(&rcvon, ev_data+ev_sz, sizeof(struct timespec));
    495491               
    496492                /* Parse the received buffer */
     
    503499                        } );
    504500                       
    505                 CHECK_FCT_DO( fd_msg_ts_set_recv(msg, &rcvon), /* ... */ );
    506                
    507501                /* If the current state does not allow receiving messages, just drop it */
    508502                if (cur_state == STATE_CLOSED) {
    509503                        /* In such case, just discard the message */
    510                         fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Purged from peer '%s''s queue (CLOSED state).", peer->p_hdr.info.pi_diamid );
     504                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Purged from peer '%s''s queue (CLOSED state).", peer->p_hdr.info.pi_diamid );
    511505                        fd_msg_free(msg);
    512506                        goto psm_loop;
     
    514508               
    515509                /* Log incoming message */
    516                 fd_msg_log( FD_MSG_LOG_RECEIVED, msg, "Received %zdb from '%s' (%s)", ev_sz, peer->p_hdr.info.pi_diamid, STATE_STR(cur_state) );
     510                //fd_msg_log( FD_MSG_LOG_RECEIVED, msg, "Received %zdb from '%s' (%s)", ev_sz, peer->p_hdr.info.pi_diamid, STATE_STR(cur_state) );
    517511       
    518512                /* Extract the header */
     
    525519                        CHECK_FCT_DO( fd_p_sr_fetch(&peer->p_sr, hdr->msg_hbhid, &req), goto psm_end );
    526520                        if (req == NULL) {
    527                                 fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Answer received with no corresponding sent request." );
     521                                //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Answer received with no corresponding sent request." );
    528522                                fd_msg_free(msg);
    529523                                goto psm_loop;
     
    535529                        /* Display the delay to receive the answer */
    536530                        {
    537                                 struct timespec reqsent, delay;
    538                                 (void) fd_msg_ts_get_sent(req, &reqsent);
    539                                 TS_DIFFERENCE( &delay, &reqsent, &rcvon );
    540                                 fd_msg_log( FD_MSG_LOG_TIMING, msg, "Answer received in %ld.%6.6ld sec.", (long)delay.tv_sec, delay.tv_nsec / 1000 );
     531                                //fd_msg_log( FD_MSG_LOG_TIMING, msg, "Answer received in %ld.%6.6ld sec.", (long)delay.tv_sec, delay.tv_nsec / 1000 );
    541532                        }
    542533                } else {
     
    586577                                default:
    587578                                        /* In such case, just discard the message */
    588                                         fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received from peer '%s' while connection was not in state %s.", peer->p_hdr.info.pi_diamid, STATE_STR(cur_state) );
     579                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received from peer '%s' while connection was not in state %s.", peer->p_hdr.info.pi_diamid, STATE_STR(cur_state) );
    589580                                        fd_msg_free(msg);
    590581                        }
     
    603594                                        if (msg) {
    604595                                                /* Only if an error occurred & the message was not saved / dumped */
    605                                                 fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)", strerror(ret) );
     596                                                //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)", strerror(ret) );
    606597                                                CHECK_FCT_DO( fd_msg_free(msg), goto psm_end);
    607598                                        }
     
    652643                                /* Cleanup the message if not done */
    653644                                if (msg) {
    654                                         fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received un-handled non-routable command from peer '%s'.", peer->p_hdr.info.pi_diamid );
     645                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received un-handled non-routable command from peer '%s'.", peer->p_hdr.info.pi_diamid );
    655646                                        CHECK_FCT_DO( fd_msg_free(msg), /* continue */);
    656647                                        msg = NULL;
     
    660651                /* At this point the message must have been fully handled already */
    661652                if (msg) {
    662                         fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error ('%s'): unhandled message.", peer->p_hdr.info.pi_diamid );
     653                        //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error ('%s'): unhandled message.", peer->p_hdr.info.pi_diamid );
    663654                        fd_msg_free(msg);
    664655                }
     
    746737                }
    747738                if (params->cer) {
    748                         fd_msg_log( FD_MSG_LOG_DROPPED, params->cer, "Internal error: this CER was not handled as expected." );
     739                        //fd_msg_log( FD_MSG_LOG_DROPPED, params->cer, "Internal error: this CER was not handled as expected." );
    749740                        CHECK_FCT_DO( fd_msg_free(params->cer), );
    750741                        params->cer = NULL;
  • libfdcore/p_sr.c

    r1052 r1078  
    119119        /* If the callback did not dispose of the message, do it now */
    120120        if (ed->request) {
    121                 fd_msg_log(FD_MSG_LOG_DROPPED, ed->request, "Expiration period completed without an answer, and the expiry callback did not dispose of the message.");
     121                //fd_msg_log(FD_MSG_LOG_DROPPED, ed->request, "Expiration period completed without an answer, and the expiry callback did not dispose of the message.");
    122122                CHECK_FCT_DO( fd_msg_free(ed->request), /* ignore */ );
    123123        }
     
    325325                        CHECK_FCT_DO( ret = fd_fifo_post(fd_g_outgoing, &sr->req),
    326326                                {
    327                                         fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Internal error: error while requeuing during failover: %s", strerror(ret) );
     327                                        //fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Internal error: error while requeuing during failover: %s", strerror(ret) );
    328328                                        CHECK_FCT_DO(fd_msg_free(sr->req), /* What can we do more? */)
    329329                                });
    330330                } else {
    331331                        /* Just free the request. */
    332                         fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Sent & unanswered local message discarded during failover." );
     332                        //fd_msg_log( FD_MSG_LOG_DROPPED, sr->req, "Sent & unanswered local message discarded during failover." );
    333333                        CHECK_FCT_DO(fd_msg_free(sr->req), /* Ignore */);
    334334                }
  • libfdcore/peers.c

    r1027 r1078  
    245245                        {
    246246                                /* fallback: destroy the message */
    247                                 fd_msg_log(FD_MSG_LOG_DROPPED, m, "Internal error: unable to requeue this message during failover process");
     247                                //fd_msg_log(FD_MSG_LOG_DROPPED, m, "Internal error: unable to requeue this message during failover process");
    248248                                CHECK_FCT_DO(fd_msg_free(m), /* What can we do more? */)
    249249                        } );
  • libfdcore/queues.c

    r767 r1078  
    7474               
    7575                /* We got one! */
    76                 fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Message lost because framework is terminating." );
     76                //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Message lost because framework is terminating." );
    7777                fd_msg_free(msg);
    7878        }
  • libfdcore/routing_dispatch.c

    r1055 r1078  
    393393
    394394                        if (!peer) {
    395                                 fd_msg_log(FD_MSG_LOG_DROPPED, *pmsg, "Unable to send error '%s' to deleted peer '%s' in reply to this message.", error_code, id);
     395                                //fd_msg_log(FD_MSG_LOG_DROPPED, *pmsg, "Unable to send error '%s' to deleted peer '%s' in reply to this message.", error_code, id);
    396396                                fd_msg_free(*pmsg);
    397397                                *pmsg = NULL;
     
    450450                        }
    451451                        if (msgptr) {   /* another error happen'd */
    452                                 fd_msg_log( FD_MSG_LOG_DROPPED, msgptr,  "An unexpected error occurred while parsing the message (%s)", strerror(ret));
     452                                //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr,  "An unexpected error occurred while parsing the message (%s)", strerror(ret));
    453453                                CHECK_FCT_DO( fd_msg_free(msgptr), /* continue */);
    454454                        }
     
    511511                               
    512512                                if (!is_req) {
    513                                         fd_msg_log( FD_MSG_LOG_DROPPED, msgptr,  "Internal error: Answer received to locally issued request, but not handled by any handler.");
     513                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr,  "Internal error: Answer received to locally issued request, but not handled by any handler.");
    514514                                        fd_msg_free(msgptr);
    515515                                        break;
     
    756756                        CHECK_FCT_DO( ret = (*rh->rt_fwd_cb)(rh->cbdata, &msgptr),
    757757                                {
    758                                         fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: a FWD routing callback returned an error (%s)", strerror(ret));
     758                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: a FWD routing callback returned an error (%s)", strerror(ret));
    759759                                        fd_msg_free(msgptr);
    760760                                        msgptr = NULL;
     
    815815                CHECK_FCT( fd_peer_getbyid( qry_src, qry_src_len, 0, (void *) &peer ) );
    816816                if (fd_peer_getstate(peer) != STATE_OPEN) {
    817                         fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Unable to forward answer to deleted / closed peer '%s'.", qry_src);
     817                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Unable to forward answer to deleted / closed peer '%s'.", qry_src);
    818818                        fd_msg_free(msgptr);
    819819                        return 0;
     
    900900                        CHECK_FCT_DO( ret = (*rh->rt_out_cb)(rh->cbdata, msgptr, candidates),
    901901                                {
    902                                         fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: an OUT routing callback returned an error (%s)", strerror(ret));
     902                                        //fd_msg_log( FD_MSG_LOG_DROPPED, msgptr, "Internal error: an OUT routing callback returned an error (%s)", strerror(ret));
    903903                                        fd_msg_free(msgptr);
    904904                                        msgptr = NULL;
     
    948948        /* If the message has not been sent, return an error */
    949949        if (msgptr) {
    950                 fd_msg_log( FD_MSG_LOG_NODELIVER, msgptr, "No suitable candidate to route the message to." );
     950                //fd_msg_log( FD_MSG_LOG_NODELIVER, msgptr, "No suitable candidate to route the message to." );
    951951                return_error( &msgptr, "DIAMETER_UNABLE_TO_DELIVER", "No suitable candidate to route the message to", NULL);
    952952        }
  • libfdcore/sctp.c

    r1027 r1078  
    10681068        size_t                   mempagesz = sysconf(_SC_PAGESIZE); /* We alloc buffer by memory pages for efficiency */
    10691069        int                      timedout = 0;
    1070         struct timespec          recv_on;
    10711070       
    10721071        TRACE_ENTRY("%p %p %p %p %p", conn, strid, buf, len, event);
     
    11891188        }
    11901189       
    1191         /* Piggy-tail the timestamp of reception */
    1192         CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &recv_on), /* continue */ );
    1193         memcpy(data + datasize, &recv_on, sizeof(struct timespec));
    1194                
    11951190        /* From this point, we have received a message */
    11961191        *event = FDEVP_CNX_MSG_RECV;
  • libfdcore/server.c

    r1061 r1078  
    169169       
    170170        /* Log incoming message */
    171         fd_msg_log( FD_MSG_LOG_RECEIVED, msg, "Received %zdb from new client '%s'", bufsz, fd_cnx_getid(c->conn) );
     171        //fd_msg_log( FD_MSG_LOG_RECEIVED, msg, "Received %zdb from new client '%s'", bufsz, fd_cnx_getid(c->conn) );
    172172       
    173173        /* We expect a CER, it must parse with our dictionary and rules */
     
    195195        /* Cleanup the parsed message if any */
    196196        if (msg) {
    197                 fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received invalid/unexpected message from connecting client '%s'", fd_cnx_getid(c->conn) );
     197                //fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received invalid/unexpected message from connecting client '%s'", fd_cnx_getid(c->conn) );
    198198                CHECK_FCT_DO( fd_msg_free(msg), /* continue */);
    199199        }
Note: See TracChangeset for help on using the changeset viewer.