Navigation


Changeset 688:8c3dc8584dab in freeDiameter for libfdcore/p_out.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_out.c

    r662 r688  
    6060        }
    6161       
    62         /* Log the message */
    63         if (TRACE_BOOL(FULL)) {
    64                 CHECK_FCT_DO(  fd_msg_update_length(*msg), /* continue */  );
    65                 TRACE_DEBUG(FULL, "Sending the following message on connection '%s':", fd_cnx_getid(cnx));
    66                 fd_msg_dump_walk(FULL, *msg);
    67         }
    68        
    6962        /* Create the message buffer */
    7063        CHECK_FCT(fd_msg_bufferize( *msg, &buf, &sz ));
    7164        pthread_cleanup_push( free, buf );
     65       
     66        /* Log the message */
     67        fd_msg_log( FD_MSG_LOG_SENT, *msg, "Sent to '%s'", fd_cnx_getid(cnx));
    7268       
    7369        /* Save a request before sending so that there is no race condition with the answer */
     
    9389        struct msg *msg = arg;
    9490        CHECK_FCT_DO(fd_fifo_post(fd_g_outgoing, &msg),
    95                         CHECK_FCT_DO(fd_msg_free(msg), /* What can we do more? */));
     91                {
     92                        fd_msg_log( FD_MSG_LOG_DROPPED, msg, "An error occurred while attempting to requeue this message during cancellation of the sending function");
     93                        CHECK_FCT_DO(fd_msg_free(msg), /* What can we do more? */);
     94                } );
    9695}
    9796
     
    112111        while (1) {
    113112                struct msg * msg;
     113                int ret;
    114114               
    115115                /* Retrieve next message to send */
     
    120120               
    121121                /* Send the message, log any error */
    122                 CHECK_FCT_DO( do_send(&msg, 0, peer->p_cnxctx, &peer->p_hbh, &peer->p_sr),
     122                CHECK_FCT_DO( ret = do_send(&msg, 0, peer->p_cnxctx, &peer->p_hbh, &peer->p_sr),
    123123                        {
    124124                                if (msg) {
    125                                         fd_log_debug("An error occurred while sending this message, it was lost:\n");
    126                                         fd_msg_dump_walk(NONE, msg);
     125                                        fd_msg_log( FD_MSG_LOG_DROPPED, msg, "Internal error: Problem while sending (%s)\n", strerror(ret) );
    127126                                        fd_msg_free(msg);
    128127                                }
     
    151150               
    152151        } else {
     152                int ret;
    153153                uint32_t *hbh = NULL;
    154154               
     
    161161
    162162                /* Do send the message */
    163                 CHECK_FCT_DO( do_send(msg, flags, cnx, hbh, peer ? &peer->p_sr : NULL),
     163                CHECK_FCT_DO( ret = do_send(msg, flags, cnx, hbh, peer ? &peer->p_sr : NULL),
    164164                        {
    165165                                if (msg) {
    166                                         fd_log_debug("An error occurred while sending this message, it was lost:\n");
    167                                         fd_msg_dump_walk(NONE, *msg);
     166                                        fd_msg_log( FD_MSG_LOG_DROPPED, *msg, "Internal error: Problem while sending (%s)\n", strerror(ret) );
    168167                                        fd_msg_free(*msg);
    169168                                        *msg = NULL;
Note: See TracChangeset for help on using the changeset viewer.