Navigation


Changeset 1103:d8591b1c56cd in freeDiameter for libfdcore/p_out.c


Ignore:
Timestamp:
May 10, 2013, 7:48:57 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Implemented a few hooks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_out.c

    r1084 r1103  
    3737
    3838/* Alloc a new hbh for requests, bufferize the message and send on the connection, save in sentreq if provided */
    39 static int do_send(struct msg ** msg, uint32_t flags, struct cnxctx * cnx, uint32_t * hbh, struct sr_list * srl)
     39static int do_send(struct msg ** msg, uint32_t flags, struct cnxctx * cnx, uint32_t * hbh, struct fd_peer * peer)
    4040{
    4141        struct msg_hdr * hdr;
     
    4545        int ret;
    4646        uint32_t bkp_hbh = 0;
    47        
    48         TRACE_ENTRY("%p %x %p %p %p", msg, flags, cnx, hbh, srl);
     47        struct msg *cpy_for_logs_only;
     48       
     49        TRACE_ENTRY("%p %x %p %p %p", msg, flags, cnx, hbh, peer);
    4950       
    5051        /* Retrieve the message header */
     
    5354        msg_is_a_req = (hdr->msg_flags & CMD_FLAG_REQUEST);
    5455        if (msg_is_a_req) {
    55                 CHECK_PARAMS(hbh && srl);
     56                CHECK_PARAMS(hbh && peer);
    5657                /* Alloc the hop-by-hop id and increment the value for next message */
    5758                bkp_hbh = hdr->msg_hbhid;
     
    6465        pthread_cleanup_push( free, buf );
    6566       
    66         // cpy_for_logs_only = *msg;
     67        cpy_for_logs_only = *msg;
    6768       
    6869        /* Save a request before sending so that there is no race condition with the answer */
    6970        if (msg_is_a_req) {
    70                 CHECK_FCT_DO( ret = fd_p_sr_store(srl, msg, &hdr->msg_hbhid, bkp_hbh), goto out );
     71                CHECK_FCT_DO( ret = fd_p_sr_store(&peer->p_sr, msg, &hdr->msg_hbhid, bkp_hbh), goto out );
    7172        }
    7273       
    7374        /* Log the message */
    74         // fd_msg_log( FD_MSG_LOG_SENT, cpy_for_logs_only, "Sent to '%s'", fd_cnx_getid(cnx));
     75        fd_hook_call(HOOK_MESSAGE_SENT, cpy_for_logs_only, peer, NULL, fd_msg_pmdl_get(cpy_for_logs_only));
    7576       
    7677        /* Send the message */
     
    127128               
    128129                /* Send the message, log any error */
    129                 CHECK_FCT_DO( ret = do_send(&msg, 0, peer->p_cnxctx, &peer->p_hbh, &peer->p_sr),
     130                CHECK_FCT_DO( ret = do_send(&msg, 0, peer->p_cnxctx, &peer->p_hbh, peer),
    130131                        {
    131132                                if (msg) {
     
    179180
    180181                /* Do send the message */
    181                 CHECK_FCT_DO( ret = do_send(msg, flags, cnx, hbh, peer ? &peer->p_sr : NULL),
     182                CHECK_FCT_DO( ret = do_send(msg, flags, cnx, hbh, peer),
    182183                        {
    183184                                if (msg) {
Note: See TracChangeset for help on using the changeset viewer.