Navigation


Changeset 229:965f5971dc23 in freeDiameter for freeDiameter/p_out.c


Ignore:
Timestamp:
Mar 2, 2010, 3:55:26 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Broadcast CEA over all streams to avoid possible race condition

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/p_out.c

    r208 r229  
    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, 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 sr_list * srl)
    4040{
    4141        struct msg_hdr * hdr;
    42         int msg_is_a_req, msg_is_appl;
     42        int msg_is_a_req;
    4343        uint8_t * buf;
    4444        size_t sz;
     
    4646        uint32_t bkp_hbh = 0;
    4747       
    48         TRACE_ENTRY("%p %p %p %p", msg, cnx, hbh, srl);
     48        TRACE_ENTRY("%p %x %p %p %p", msg, flags, cnx, hbh, srl);
    4949       
    5050        /* Retrieve the message header */
     
    5959                *hbh = hdr->msg_hbhid + 1;
    6060        }
    61        
    62         msg_is_appl = fd_msg_is_routable(*msg);
    6361       
    6462        /* Log the message */
     
    7977       
    8078        /* Send the message */
    81         CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, !msg_is_appl), { free(buf); return ret; } );
     79        CHECK_FCT_DO( ret = fd_cnx_send(cnx, buf, sz, flags), { free(buf); return ret; } );
    8280        pthread_cleanup_pop(1);
    8381       
     
    122120               
    123121                /* Send the message, log any error */
    124                 CHECK_FCT_DO( do_send(&msg, peer->p_cnxctx, &peer->p_hbh, &peer->p_sr),
     122                CHECK_FCT_DO( do_send(&msg, 0, peer->p_cnxctx, &peer->p_hbh, &peer->p_sr),
    125123                        {
    126124                                fd_log_debug("An error occurred while sending this message, it is lost:\n");
     
    139137}
    140138
    141 /* Wrapper to sending a message either by out thread (peer in OPEN state) or directly; cnx or peer must be provided */
    142 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer)
     139/* Wrapper to sending a message either by out thread (peer in OPEN state) or directly; cnx or peer must be provided. Flags are valid only for direct sending, not through thread (unused) */
     140int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, uint32_t flags)
    143141{
    144         TRACE_ENTRY("%p %p %p", msg, cnx, peer);
     142        TRACE_ENTRY("%p %p %p %x", msg, cnx, peer, flags);
    145143        CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx)));
    146144       
     
    160158
    161159                /* Do send the message */
    162                 CHECK_FCT_DO( do_send(msg, cnx, hbh, peer ? &peer->p_sr : NULL),
     160                CHECK_FCT_DO( do_send(msg, flags, cnx, hbh, peer ? &peer->p_sr : NULL),
    163161                        {
    164162                                fd_log_debug("An error occurred while sending this message, it is lost:\n");
Note: See TracChangeset for help on using the changeset viewer.