Navigation


Changeset 1207:043b894b0511 in freeDiameter for libfdcore/p_sr.c


Ignore:
Timestamp:
Jun 14, 2013, 6:30:42 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Cleanups in failover situation to avoid deadlocks and corrupt messages ids. Tested OK now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/p_sr.c

    r1188 r1207  
    3838/* Structure to store a sent request */
    3939struct sentreq {
    40         struct fd_list  chain;  /* the "o" field points directly to the hop-by-hop of the request (uint32_t *)  */
     40        struct fd_list  chain;  /* the "o" field points directly to the (new) hop-by-hop of the request (uint32_t *)  */
    4141        struct msg      *req;   /* A request that was sent and not yet answered. */
    42         uint32_t        prevhbh;/* The value to set in the hbh header when the message is retrieved */
     42        uint32_t        prevhbh;/* The value to set back in the hbh header when the message is retrieved */
    4343        struct fd_list  expire; /* the list of expiring requests */
    4444        struct timespec added_on; /* the time the request was added */
     
    6666        struct timespec now;
    6767       
    68         if (!TRACE_BOOL(ANNOYING))
    69                 return;
    70        
    71         fd_log_debug("%sSentReq list @%p:", text, srlist);
     68        LOG_D("%sSentReq list @%p:", text, srlist);
    7269       
    7370        CHECK_SYS_DO( clock_gettime(CLOCK_REALTIME, &now), );
     
    7774                uint32_t * nexthbh = li->o;
    7875               
    79                 fd_log_debug(" - Next req (hbh:%x): [since %ld.%06ld sec]", *nexthbh,
     76                LOG_D(" - Next req (hbh:0x%x, prev:0x%x): [since %ld.%06ld sec]", *nexthbh, sr->prevhbh,
    8077                        (long)((now.tv_nsec >= sr->added_on.tv_nsec) ? (now.tv_sec - sr->added_on.tv_sec) : (now.tv_sec - sr->added_on.tv_sec - 1)),
    8178                        (long)((now.tv_nsec >= sr->added_on.tv_nsec) ? ((now.tv_nsec - sr->added_on.tv_nsec) / 1000) : ((now.tv_nsec - sr->added_on.tv_nsec + 1000000000) / 1000)));
     
    225222        next = find_or_next(&srlist->srs, *hbhloc, &match);
    226223        if (match) {
    227                 TRACE_DEBUG(INFO, "A request with the same hop-by-hop Id was already sent: error");
     224                TRACE_DEBUG(INFO, "A request with the same hop-by-hop Id (0x%x) was already sent: error", *hbhloc);
    228225                free(sr);
     226                srl_dump("Current list of SR: ", &srlist->srs);
    229227                CHECK_POSIX_DO( pthread_mutex_unlock(&srlist->mtx), /* ignore */ );
    230228                return EINVAL;
     
    235233        fd_list_insert_before(next, &sr->chain);
    236234        srlist->cnt++;
    237         srl_dump("Saved new request, ", &srlist->srs);
    238235       
    239236        /* In case of request with a timeout, also store in the timeout list */
     
    280277        /* Search the request in the list */
    281278        CHECK_POSIX( pthread_mutex_lock(&srlist->mtx) );
    282         srl_dump("Fetching a request, ", &srlist->srs);
    283279        sr = (struct sentreq *)find_or_next(&srlist->srs, hbh, &match);
    284280        if (!match) {
    285281                TRACE_DEBUG(INFO, "There is no saved request with this hop-by-hop id (%x)", hbh);
     282                srl_dump("Current list of SR: ", &srlist->srs);
    286283                *req = NULL;
    287284        } else {
Note: See TracChangeset for help on using the changeset viewer.