Navigation


Changeset 124:cc42d8607114 in freeDiameter for freeDiameter/queues.c


Ignore:
Timestamp:
Dec 10, 2009, 2:15:04 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Completed cleanups of queues when the daemon is stopping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/queues.c

    r123 r124  
    5151}
    5252
    53 /* Destroy the routing message queues */
    54 int fd_queues_fini_rt(void)
     53/* Destroy a queue after emptying it (and dumping the content) */
     54int fd_queues_fini(struct fifo ** queue)
    5555{
    56         TRACE_ENTRY();
     56        struct msg * msg;
     57        int ret = 0;
    5758       
     59        TRACE_ENTRY("%p", queue);
     60       
     61        /* Note : the threads that post into this queue should already been stopped before this !!! */
     62
    5863        /* Empty all contents */
    59         TODO("Empty all contents (dump to log file ?)");
     64        while (1) {
     65                /* Check if there is a message in the queue */
     66                ret = fd_fifo_tryget(*queue, &msg);
     67                if (ret == EWOULDBLOCK)
     68                        break;
     69                CHECK_FCT(ret);
     70               
     71                /* We got one! */
     72                fd_log_debug("The following message is lost because the daemon is stopping:\n");
     73                fd_msg_dump_walk(NONE, msg);
     74                fd_msg_free(msg);
     75        }
    6076       
    61         /* Now, delete the queues */
    62         CHECK_FCT( fd_fifo_del ( &fd_g_incoming ) );
    63         CHECK_FCT( fd_fifo_del ( &fd_g_outgoing ) );
     77        /* Now, delete the empty queue */
     78        CHECK_FCT( fd_fifo_del ( queue ) );
    6479       
    6580        return 0;
    6681}
    67 
    68 /* Destroy the local message queue */
    69 int fd_queues_fini_disp(void)
    70 {
    71         TRACE_ENTRY();
    72        
    73         /* Empty all contents */
    74         TODO("Empty all contents (dump to log file ?)");
    75        
    76         CHECK_FCT( fd_fifo_del ( &fd_g_local ) );
    77        
    78         return 0;
    79 }
Note: See TracChangeset for help on using the changeset viewer.