Ignore:
Timestamp:
07/16/15 20:40:01 (9 years ago)
Author:
tim
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/nanownlib/__init__.py

    r10 r11  
    220220        if p['sent']==1 and (seen[key]['observed'] > p['observed']): #earliest sent
    221221            seen[key] = p
    222             suspect += 's'
     222            suspect += 's' # duplicated sent packets
    223223            continue
    224224        if p['sent']==0 and (seen[key]['observed'] > p['observed']): #earliest rcvd
    225225            seen[key] = p
    226             suspect += 'r'
     226            suspect += 'r' # duplicated received packets
    227227            continue
    228228   
     
    236236    suspect,packets = removeDuplicatePackets(packets)
    237237
    238     sort_key = lambda d: (d['tcpseq'],d['observed'])
     238    sort_key = lambda d: (d['observed'],d['tcpseq'])
     239    alt_key = lambda d: (d['tcpseq'],d['observed'])
    239240    sent = sorted((p for p in packets if p['sent']==1 and p['payload_len']>0), key=sort_key)
    240241    rcvd = sorted((p for p in packets if p['sent']==0 and p['payload_len']>0), key=sort_key)
    241 
    242     alt_key = lambda d: (d['observed'],d['tcpseq'])
    243242    rcvd_alt = sorted((p for p in packets if p['sent']==0 and p['payload_len']>0), key=alt_key)
    244243
    245244    s_off = trim_sent
    246245    if s_off >= len(sent):
     246        suspect += 'd' # dropped packet?
    247247        s_off = -1
    248248    last_sent = sent[s_off]
    249249
    250250    r_off = len(rcvd) - trim_rcvd - 1
    251     if r_off <= 0:
     251    if r_off < 0:
     252        suspect += 'd' # dropped packet?
    252253        r_off = 0
    253254    last_rcvd = rcvd[r_off]
    254255    if last_rcvd != rcvd_alt[r_off]:
    255         suspect += 'R'
     256        suspect += 'R' # reordered received packets
    256257   
    257258    packet_rtt = last_rcvd['observed'] - last_sent['observed']
     
    263264        last_sent_ack = min(((p['observed'],p) for p in packets
    264265                             if p['sent']==0 and p['payload_len']+last_sent['tcpseq']==p['tcpack']))[1]
     266       
    265267    except Exception as e:
    266268        sys.stderr.write("WARN: Could not find last_sent_ack.\n")
     
    301303def analyzeProbes(db):
    302304    db.conn.execute("CREATE INDEX IF NOT EXISTS packets_probe ON packets (probe_id)")
     305    db.conn.commit()
     306
    303307    pcursor = db.conn.cursor()
    304     db.conn.commit()
    305 
    306308    pcursor.execute("SELECT tcpts_mean FROM meta")
    307309    try:
     
    346348            db.addTrimAnalyses([analysis])
    347349        except Exception as e:
    348             traceback.print_exc()
     350            #traceback.print_exc()
    349351            sys.stderr.write("WARN: couldn't find enough packets for probe_id=%s\n" % probe_id)
    350352       
     
    367369                    analysis['probe_id'] = probe_id
    368370                except Exception as e:
    369                     print(e)
    370                     sys.stderr.write("WARN: couldn't find enough packets for probe_id=%s\n" % pid)
     371                    #traceback.print_exc()
     372                    sys.stderr.write("WARN: couldn't find enough packets for probe_id=%s\n" % probe_id)
    371373                   
    372374                db.addTrimAnalyses([analysis])
Note: See TracChangeset for help on using the changeset viewer.