Skip to content

Commit

Permalink
discard non-observed flows and flows with no syn observed (fixes: #31)
Browse files Browse the repository at this point in the history
  • Loading branch information
irl committed Sep 17, 2016
1 parent 854de72 commit 2bc6c84
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pathspider/plugins/ecnspider3.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def connect(self, job, pcs, config):

job_ip, job_port, job_host, job_rank = job

tstart = datetime.utcnow()
tstart = str(datetime.utcnow())

if ":" in job_ip:
sock = socket.socket(socket.AF_INET6)
Expand All @@ -131,7 +131,7 @@ def post_connect(self, job, conn, pcs, config):

job_ip, job_port, job_host, job_rank = job

tstop = datetime.utcnow()
tstop = str(datetime.utcnow())

if conn.state == CONN_OK:
rec = SpiderRecord(job_ip, job_port, conn.port, job_rank, job_host, config, True, conn.tstart, tstop)
Expand Down Expand Up @@ -176,6 +176,11 @@ def combine_flows(self, flow):
# first has always ecn off, while the second has ecn on
flows = (flow, other_flow) if other_flow['ecnstate'] else (other_flow, flow)

# discard non-observed flows and flows with no syn observed
for f in flows:
if not (f['observed'] and "rev_syn_flags" in f.keys()):
return

tstart = min(flow['tstart'], other_flow['tstart'])
tstop = max(flow['tstop'], other_flow['tstop'])

Expand All @@ -188,6 +193,7 @@ def combine_flows(self, flow):
else:
cond_conn = 'ecn.connectivity.offline'

# FIXME: I need to be convinced this is a complete test
if flows[1]['rev_syn_flags'] & TCP_SAEW == TCP_SAE:
cond_nego = 'ecn.negotiated'
else:
Expand All @@ -202,8 +208,8 @@ def combine_flows(self, flow):
'rank': flow['rank'],
'flow_results': flows,
'time': {
'from': tstart.isoformat(),
'to': tstop.isoformat()
'from': tstart,
'to': tstop
}
})
else:
Expand Down

2 comments on commit 2bc6c84

@britram
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why stringify the datetime? (is this faster, or does it just make debugging easier?)

@irl
Copy link
Member Author

@irl irl commented on 2bc6c84 Sep 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something else was accessing the tstart and tstop and throwing type errors, but i can't remember what it was.

Please sign in to comment.