Navigation


Changeset 1010:357c2f892d24 in freeDiameter for libfdcore/p_out.c


Ignore:
Timestamp:
Mar 26, 2013, 12:39:32 AM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Implement a new counter on pending answers to send back to a peer.
Function fd_peer_get_load_pending updated to retrieve this counter as well.
When a peer has answers pending, the connection is not immediately teared down
upon DPR/DPA exchange, but a GRACE_TIMEOUT delay (default 1 sec) is granted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_out.c

    r975 r1010  
    173173int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, uint32_t flags)
    174174{
     175        struct msg_hdr * hdr;
     176       
    175177        TRACE_ENTRY("%p %p %p %x", msg, cnx, peer, flags);
    176178        CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx)));
     179       
     180        if (peer) {
     181                CHECK_FCT( fd_msg_hdr(*msg, &hdr) );
     182                if (!(hdr->msg_flags & CMD_FLAG_REQUEST)) {
     183                        /* Update the count of pending answers to send */
     184                        CHECK_POSIX( pthread_mutex_lock(&peer->p_state_mtx) );
     185                        peer->p_reqin_count--;
     186                        CHECK_POSIX( pthread_mutex_unlock(&peer->p_state_mtx) );                       
     187                }
     188        }
    177189       
    178190        if (fd_peer_getstate(peer) == STATE_OPEN) {
Note: See TracChangeset for help on using the changeset viewer.