Пример #1
0
probe_t * probe_dup(const probe_t * probe)
{
    probe_t  * ret;
    packet_t * packet;

    if (!(packet = packet_dup(probe->packet)))            goto ERR_PACKET_DUP;
    if (!(ret = probe_wrap_packet(packet)))               goto ERR_PROBE_WRAP_PACKET;
//    if (!(ret->bitfield = bitfield_dup(probe->bitfield))) goto ERR_BITFIELD_DUP;

    ret->sending_time  = probe->sending_time;
    ret->queueing_time = probe->queueing_time;
    ret->recv_time     = probe->recv_time;
    ret->caller        = probe->caller;
#ifdef USE_SCHEDULING
    ret->delay         = probe->delay ? field_dup(probe->delay): NULL;
#endif
    return ret;

    /*
ERR_BITFIELD_DUP:
    probe_free(ret);
    packet = NULL;
    */
ERR_PROBE_WRAP_PACKET:
    if (packet) packet_free(packet);
ERR_PACKET_DUP:
    return NULL;
}
Пример #2
0
void top_half_queue_add(struct packet_object *po)
{
   struct po_queue_entry *e;

   SAFE_CALLOC(e, 1, sizeof(struct po_queue_entry));
   
   e->po = packet_dup(po, PO_DUP_NONE);
   
   PO_QUEUE_LOCK;
   
   /* add the message to the queue */
   STAILQ_INSERT_TAIL(&po_queue, e, next);
   
   /* update the stats */
   stats_queue_add();
   
   PO_QUEUE_UNLOCK;
}