Navigation


Changeset 1207:043b894b0511 in freeDiameter for libfdcore/peers.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/peers.c

    r1201 r1207  
    7878        fd_list_init(&p->p_expiry, p);
    7979        CHECK_FCT( fd_fifo_new(&p->p_tosend, 5) );
     80        CHECK_FCT( fd_fifo_new(&p->p_tofailover, 0) );
    8081        p->p_hbh = lrand48();
    8182       
     
    233234        }
    234235
    235 /* Empty the lists of p_tosend and p_sentreq messages */
     236/* Empty the lists of p_tosend, p_failover, and p_sentreq messages */
    236237void fd_peer_failover_msg(struct fd_peer * peer)
    237238{
     
    258259        }
    259260       
     261        /* Requeue all messages in the "failover" queue */
     262        while ( fd_fifo_tryget(peer->p_tofailover, &m) == 0 ) {
     263                fd_hook_call(HOOK_MESSAGE_FAILOVER, m, peer, NULL, fd_msg_pmdl_get(m));
     264                CHECK_FCT_DO(fd_fifo_post_noblock(fd_g_outgoing, (void *)&m),
     265                        {
     266                                /* fallback: destroy the message */
     267                                fd_hook_call(HOOK_MESSAGE_DROPPED, m, NULL, "Internal error: unable to requeue this message during failover process", fd_msg_pmdl_get(m));
     268                                CHECK_FCT_DO(fd_msg_free(m), /* What can we do more? */)
     269                        } );
     270        }
     271       
    260272        /* Requeue all routable sent requests */
    261273        fd_p_sr_failover(&peer->p_sr);
     
    335347       
    336348        CHECK_FCT_DO( fd_fifo_del(&p->p_tosend), /* continue */ );
     349        CHECK_FCT_DO( fd_fifo_del(&p->p_tofailover), /* continue */ );
    337350        CHECK_POSIX_DO( pthread_mutex_destroy(&p->p_state_mtx), /* continue */);
    338351        CHECK_POSIX_DO( pthread_mutex_destroy(&p->p_sr.mtx), /* continue */);
Note: See TracChangeset for help on using the changeset viewer.