Ignore:
Timestamp:
12/21/06 16:30:42 (15 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
e7d66bf
Parents:
496b8e5
Message:

Fixed trace_event_trace so that it doesn't free the buffer containing the packet data before returning it. There's probably a more efficient way of doing it than what I did here, but at least it works now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_helper.c

    r33d83d4 r2a1a502  
    103103                         * event.size will sort out the error
    104104                         */
     105                        if (trace_is_err(trace)) {
     106                                trace_perror(trace, "read packet");
     107                        }
    105108                        event.type = TRACE_EVENT_TERMINATE;
    106109                        return event;
     
    140143        /* This is the first packet, so just fire away. */
    141144        /* TODO: finalise packet */
    142         *packet = *trace->event.packet;
     145       
     146        /* XXX: Could we do this more efficiently? */
     147        /* We do a lot of freeing and creating of packet buffers with this
     148         * method, but at least it works unlike what was here previously */
     149        if (packet->buf_control == TRACE_CTRL_PACKET) {
     150                free(packet->buffer);
     151        }
     152               
     153        packet->type = trace->event.packet->type;
     154        packet->trace = trace->event.packet->trace;
     155        packet->header = trace->event.packet->header;
     156        packet->payload = trace->event.packet->payload;
     157       
     158        packet->buffer = trace->event.packet->buffer;
     159        packet->buf_control = trace->event.packet->buf_control;
     160
     161        trace->event.packet->buf_control = TRACE_CTRL_EXTERNAL;
     162       
    143163        trace_destroy_packet(trace->event.packet);
    144164        trace->event.packet = NULL;
Note: See TracChangeset for help on using the changeset viewer.