Navigation


Changeset 1188:f40de74bd1c7 in freeDiameter


Ignore:
Timestamp:
Jun 10, 2013, 3:27:15 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Don't block PSM during failover

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdproto.h

    r1186 r1188  
    31223122        fd_fifo_post_int((queue), (void *)(item))
    31233123
     3124/* Similar function but does not block. It can cause the number of items in the queue to exceed the maximum set. Do not use for normal operation,
     3125only for failure recovery for example. */
     3126int fd_fifo_post_noblock( struct fifo * queue, void ** item );
     3127
    31243128/*
    31253129 * FUNCTION:    fd_fifo_get
  • libfdcore/p_sr.c

    r1153 r1188  
    327327                       
    328328                        /* Requeue for sending to another peer */
    329                         CHECK_FCT_DO( ret = fd_fifo_post(fd_g_outgoing, &sr->req),
     329                        CHECK_FCT_DO( ret = fd_fifo_post_noblock(fd_g_outgoing, (void *)&sr->req),
    330330                                {
    331331                                        char buf[256];
  • libfdcore/peers.c

    r1186 r1188  
    243243        while ( fd_fifo_tryget(peer->p_tosend, &m) == 0 ) {
    244244                fd_hook_call(HOOK_MESSAGE_FAILOVER, m, peer, NULL, fd_msg_pmdl_get(m));
    245                 CHECK_FCT_DO(fd_fifo_post(fd_g_outgoing, &m),
     245                CHECK_FCT_DO(fd_fifo_post_noblock(fd_g_outgoing, (void *)&m),
    246246                        {
    247247                                /* fallback: destroy the message */
  • libfdproto/fifo.c

    r1186 r1188  
    377377
    378378/* Post a new item in the queue */
    379 int fd_fifo_post_int ( struct fifo * queue, void ** item )
     379int fd_fifo_post_internal ( struct fifo * queue, void ** item, int skip_max )
    380380{
    381381        struct fifo_item * new;
     
    383383        struct timespec posted_on, queued_on;
    384384       
    385         TRACE_ENTRY( "%p %p", queue, item );
    386        
    387         /* Check the parameters */
    388         CHECK_PARAMS( CHECK_FIFO( queue ) && item && *item );
    389        
    390385        /* Get the timing of this call */
    391386        CHECK_SYS(  clock_gettime(CLOCK_REALTIME, &posted_on)  );
     
    394389        CHECK_POSIX(  pthread_mutex_lock( &queue->mtx )  );
    395390       
    396         if (queue->max) {
     391        if ((!skip_max) && (queue->max)) {
    397392                while (queue->count >= queue->max) {
    398393                        int ret = 0;
     
    460455        /* Done */
    461456        return 0;
     457}
     458
     459/* Post a new item in the queue */
     460int fd_fifo_post_int ( struct fifo * queue, void ** item )
     461{
     462        TRACE_ENTRY( "%p %p", queue, item );
     463       
     464        /* Check the parameters */
     465        CHECK_PARAMS( CHECK_FIFO( queue ) && item && *item );
     466       
     467        return fd_fifo_post_internal ( queue,item, 0 );
     468       
     469}
     470
     471/* Post a new item in the queue, not blocking */
     472int fd_fifo_post_noblock ( struct fifo * queue, void ** item )
     473{
     474        TRACE_ENTRY( "%p %p", queue, item );
     475       
     476        /* Check the parameters */
     477        CHECK_PARAMS( CHECK_FIFO( queue ) && item && *item );
     478       
     479        return fd_fifo_post_internal ( queue,item, 1 );
     480       
    462481}
    463482
Note: See TracChangeset for help on using the changeset viewer.