aboutsummaryrefslogtreecommitdiffstats
path: root/netlib/tcp.py
diff options
context:
space:
mode:
authorIsrael Nir <israelnir@Israel-Nirs-MacBook-Pro.local>2013-01-10 15:51:37 +0200
committerIsrael Nir <israelnir@Israel-Nirs-MacBook-Pro.local>2013-01-10 15:51:37 +0200
commit10457e876ad6db9c66973c925b7e65f2a16ffbca (patch)
tree4942b6424ee990d312c13650867367b08026fa16 /netlib/tcp.py
parente4acace8ea741af798523d6ff1d148d129f23582 (diff)
downloadmitmproxy-10457e876ad6db9c66973c925b7e65f2a16ffbca.tar.gz
mitmproxy-10457e876ad6db9c66973c925b7e65f2a16ffbca.tar.bz2
mitmproxy-10457e876ad6db9c66973c925b7e65f2a16ffbca.zip
adding read timestamp to enable better resolution of when certain reads were performed (timestamp is updated when the first byte is available on the network)
Diffstat (limited to 'netlib/tcp.py')
-rw-r--r--netlib/tcp.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 7656e398..76fb7ca0 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -44,6 +44,7 @@ class _FileLike:
def __init__(self, o):
self.o = o
self._log = None
+ self.timestamp = None
def set_descriptor(self, o):
self.o = o
@@ -80,6 +81,8 @@ class _FileLike:
if self.is_logging():
self._log.append(v)
+ def reset_timestamp(self):
+ self.timestamp = None
class Writer(_FileLike):
def flush(self):
@@ -131,6 +134,7 @@ class Reader(_FileLike):
raise NetLibDisconnect
except SSL.SysCallError, v:
raise NetLibDisconnect
+ self.timestamp = self.timestamp or time.time()
if not data:
break
result += data