Navigation


Changes in / [967:bbc08d58325a:968:652713ce3596] in freeDiameter


Ignore:
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdcore.h

    r947 r968  
    385385int fd_peer_get_state(struct peer_hdr *peer);
    386386
     387/*
     388 * FUNCTION:    fd_peer_get_load_pending
     389 *
     390 * PARAMETERS:
     391 *  peer        : The peer which load to read
     392 *
     393 * DESCRIPTION:
     394 *   Returns the current number of requests sent to this peer
     395 *  that have not been answered yet. This is an empirical indication
     396 *  of the workload of this peer.
     397 *
     398 * RETURN VALUE:
     399 *  0  : The load parameter has been updated. (it should have a positive value always)
     400 * !0  : An error occurred
     401 */
     402int fd_peer_get_load_pending(struct peer_hdr *peer, int * load);
     403
    387404/*
    388405 * FUNCTION:    fd_peer_validate_register
  • libfdcore/fdcore-internal.h

    r928 r938  
    126126        struct fd_list  srs; /* requests ordered by hop-by-hop id */
    127127        struct fd_list  exp; /* requests that have a timeout set, ordered by timeout */
     128        int             cnt; /* number of requests in the srs list */
    128129        pthread_mutex_t mtx; /* mutex to protect these lists */
    129130        pthread_cond_t  cnd; /* cond var used by the thread that handles timeouts */
  • libfdcore/fdd.l

    r961 r968  
    5252        yylloc->first_column = yylloc->last_column + 1;                 \
    5353        yylloc->last_column = yylloc->first_column + yyleng - 1;        \
    54         TRACE_DEBUG_ERROR(                                              \
     54        fd_log_debug(                                                   \
    5555                "(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n", \
    5656                yylloc->first_line, yylloc->first_column,               \
  • libfdcore/p_sr.c

    r837 r938  
    226226        *req = NULL;
    227227        fd_list_insert_before(next, &sr->chain);
     228        srlist->cnt++;
    228229        srl_dump("Saved new request, ", &srlist->srs);
    229230       
     
    281282                /* Unlink */
    282283                fd_list_unlink(&sr->chain);
     284                srlist->cnt--;
    283285                fd_list_unlink(&sr->expire);
    284286                *req = sr->req;
     
    300302                struct sentreq * sr = (struct sentreq *)(srlist->srs.next);
    301303                fd_list_unlink(&sr->chain);
     304                srlist->cnt--;
    302305                fd_list_unlink(&sr->expire);
    303306                if (fd_msg_is_routable(sr->req)) {
  • libfdcore/peers.c

    r961 r968  
    257257}
    258258
     259/* Return the value of srlist->cnt */
     260int fd_peer_get_load_pending(struct peer_hdr *peer, int * load)
     261{
     262        struct fd_peer * p = (struct fd_peer *)peer;
     263        TRACE_ENTRY("%p %p", peer, load);
     264        CHECK_PARAMS(CHECK_PEER(peer) && load);
     265       
     266        CHECK_POSIX( pthread_mutex_lock(&p->p_sr.mtx) );
     267        *load = p->p_sr.cnt;
     268        CHECK_POSIX( pthread_mutex_unlock(&p->p_sr.mtx) );
     269       
     270        return 0;
     271}
     272
     273
    259274/* Destroy a structure once cleanups have been performed (fd_psm_abord, ...) */
    260275int fd_peer_free(struct fd_peer ** ptr)
     
    395410        }
    396411
    397         fd_log_debug(">  %s\t%s", STATE_STR(fd_peer_getstate(peer)), peer->p_hdr.info.pi_diamid);
     412        fd_log_debug(">  %s\t%s\t[%dsr]", STATE_STR(fd_peer_getstate(peer)), peer->p_hdr.info.pi_diamid, peer->p_sr.cnt);
    398413        if (details > INFO) {
    399414                fd_log_debug("\t(rlm:%s)", peer->p_hdr.info.runtime.pir_realm ?: "<unknown>");
Note: See TracChangeset for help on using the changeset viewer.