Navigation


Changeset 688:8c3dc8584dab in freeDiameter for libfdcore/p_psm.c


Ignore:
Timestamp:
Jan 19, 2011, 7:05:30 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Prepared capability for messages logging to separate files / folders

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_psm.c

    r662 r688  
    166166                        case FDEVP_CNX_INCOMING: {
    167167                                struct cnx_incoming * evd = ev->data;
     168                                fd_msg_log( FD_MSG_LOG_DROPPED, evd->cer, "Message discarded while cleaning peer state machine queue." );
    168169                                CHECK_FCT_DO( fd_msg_free(evd->cer), /* continue */);
    169170                                fd_cnx_destroy(evd->cnx);
     
    394395                        } );
    395396               
    396                 TRACE_DEBUG(FULL, "Received a message (%zdb) from '%s'", ev_sz, peer->p_hdr.info.pi_diamid);
    397                 if (TRACE_BOOL(FULL+1)) {
    398                         CHECK_FCT_DO( fd_msg_parse_dict( msg, fd_g_config->cnf_dict, NULL ), );
    399                         fd_msg_dump_walk(FULL, msg);
    400                 } else {
    401                         fd_msg_dump_one(FULL, msg);
    402                 }
     397                /* Log incoming message */
     398                fd_msg_log( FD_MSG_LOG_RECEIVED, msg, "Received %zdb from '%s'", ev_sz, peer->p_hdr.info.pi_diamid );
    403399       
    404400                /* Extract the header */
     
    411407                        CHECK_FCT_DO( fd_p_sr_fetch(&peer->p_sr, hdr->msg_hbhid, &req), goto psm_end );
    412408                        if (req == NULL) {
    413                                 fd_log_debug("Received a Diameter answer message with no corresponding sent request, discarding.\n");
    414                                 fd_msg_dump_walk(NONE, msg);
     409                                fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Answer received with no corresponding sent request." );
    415410                                fd_msg_free(msg);
    416411                                goto psm_loop;
     
    453448                                default:
    454449                                        /* In such case, just discard the message */
    455                                         fd_log_debug("Received a routable message while not in OPEN state from peer '%s', discarded.\n", peer->p_hdr.info.pi_diamid);
    456                                         fd_msg_dump_walk(NONE, msg);
     450                                        fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received from peer '%s' while connection was not in OPEN state.", peer->p_hdr.info.pi_diamid );
    457451                                        fd_msg_free(msg);
    458452                        }
     
    468462                                if (msg) {
    469463                                        /* Send the error back to the peer */
    470                                         CHECK_FCT_DO( fd_out_send(&msg, NULL, peer, FD_CNX_ORDERED), /* In case of error the message has already been dumped */ );
     464                                        CHECK_FCT_DO( ret = fd_out_send(&msg, NULL, peer, FD_CNX_ORDERED), );
    471465                                        if (msg) {
     466                                                /* Only if an error occurred & the message was not saved / dumped */
     467                                                fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)\n", strerror(ret) );
    472468                                                CHECK_FCT_DO( fd_msg_free(msg), goto psm_end);
    473469                                        }
     
    498494                        default:
    499495                                /* Unknown / unexpected / invalid message */
    500                                 fd_log_debug("Received an unknown local message from peer '%s', discarded.\n", peer->p_hdr.info.pi_diamid);
    501                                 fd_msg_dump_walk(NONE, msg);
     496                                TRACE_DEBUG(INFO, "Invalid non-routable command received: %u.", hdr->msg_code);
    502497                                if (hdr->msg_flags & CMD_FLAG_REQUEST) {
    503498                                        do {
     
    518513                                /* Cleanup the message if not done */
    519514                                if (msg) {
     515                                        fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Received un-handled non-routable command from peer '%s'.", peer->p_hdr.info.pi_diamid );
    520516                                        CHECK_FCT_DO( fd_msg_free(msg), /* continue */);
    521517                                        msg = NULL;
     
    525521                /* At this point the message must have been fully handled already */
    526522                if (msg) {
    527                         fd_log_debug("Internal error: unhandled message (discarded)!\n");
    528                         fd_msg_dump_walk(NONE, msg);
     523                        fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: unhandled message.", peer->p_hdr.info.pi_diamid );
    529524                        fd_msg_free(msg);
    530525                }
     
    602597                }
    603598                if (params->cer) {
     599                        fd_msg_log( FD_MSG_LOG_DROPPED, params->cer, "Internal error: this CER was not handled as expected." );
    604600                        CHECK_FCT_DO( fd_msg_free(params->cer), );
    605601                        params->cer = NULL;
Note: See TracChangeset for help on using the changeset viewer.