Changeset 95fee28 for lib


Ignore:
Timestamp:
01/03/08 11:30:31 (14 years ago)
Author:
Perry Lorier <perry@…>
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:
2c124cf
Parents:
f3f3558
Message:

Fix issue where if people called one loss counter function,
but then repeditively called another then the cache was never
refreshed.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_bpf.c

    rf3f3558 r95fee28  
    210210         * immediately after get_dropped_packets
    211211         */
    212         if (FORMATIN(trace)->stats_valid != 2) {
     212        if ((FORMATIN(trace)->stats_valid & 1)
     213                || (FORMATIN(trace)->stats_valid == 0)) {
    213214                ioctl(FORMATIN(trace)->fd, BIOCGSTATS, &FORMATIN(trace)->stats);
    214                 FORMATIN(trace)->stats_valid = 1;
     215                FORMATIN(trace)->stats_valid |= 1;
    215216        }
    216217
     
    224225         * immediately after get_received_packets
    225226         */
    226         if (!FORMATIN(trace)->stats_valid != 1) {
     227        if ((FORMATIN(trace)->stats_valid & 2)
     228                || (FORMATIN(trace)->stats_valid == 0)) {
    227229                ioctl(FORMATIN(trace)->fd, BIOCGSTATS, &FORMATIN(trace)->stats);
    228                 FORMATIN(trace)->stats_valid = 2;
     230                FORMATIN(trace)->stats_valid |= 2;
    229231        }
    230232
  • lib/format_linux.c

    rf3f3558 r95fee28  
    506506/* Number of packets that past filtering */
    507507static uint64_t linuxnative_get_captured_packets(libtrace_t *trace) {
    508         if (FORMAT(trace->format_data)->stats_valid != 2) {
     508        if ((FORMAT(trace->format_data)->stats_valid & 1)
     509                        || FORMAT(trace->format_data)->stats_valid == 0) {
    509510                socklen_t len = sizeof(FORMAT(trace->format_data)->stats);
    510511                getsockopt(FORMAT(trace->format_data)->fd,
     
    513514                                &FORMAT(trace->format_data)->stats,
    514515                                &len);
    515                 FORMAT(trace->format_data)->stats_valid = 1;
     516                FORMAT(trace->format_data)->stats_valid |= 1;
    516517        }
    517518
     
    523524 */
    524525static uint64_t linuxnative_get_dropped_packets(libtrace_t *trace) {
    525         if (FORMAT(trace->format_data)->stats_valid != 1) {
     526        if ((FORMAT(trace->format_data)->stats_valid & 2)
     527                        || (FORMAT(trace->format_data)->stats_valid==0)) {
    526528                socklen_t len = sizeof(FORMAT(trace->format_data)->stats);
    527529                getsockopt(FORMAT(trace->format_data)->fd,
     
    530532                                &FORMAT(trace->format_data)->stats,
    531533                                &len);
    532                 FORMAT(trace->format_data)->stats_valid = 2;
     534                FORMAT(trace->format_data)->stats_valid |= 2;
    533535        }
    534536
Note: See TracChangeset for help on using the changeset viewer.