Navigation


Changeset 939:1bc052ef961f in freeDiameter


Ignore:
Timestamp:
Mar 12, 2013, 11:27:59 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Add a function to access this counter

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdcore.h

    r904 r939  
    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/peers.c

    r933 r939  
    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.