mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
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)
This commit is contained in:
parent
e4acace8ea
commit
10457e876a
@ -44,6 +44,7 @@ class _FileLike:
|
|||||||
def __init__(self, o):
|
def __init__(self, o):
|
||||||
self.o = o
|
self.o = o
|
||||||
self._log = None
|
self._log = None
|
||||||
|
self.timestamp = None
|
||||||
|
|
||||||
def set_descriptor(self, o):
|
def set_descriptor(self, o):
|
||||||
self.o = o
|
self.o = o
|
||||||
@ -80,6 +81,8 @@ class _FileLike:
|
|||||||
if self.is_logging():
|
if self.is_logging():
|
||||||
self._log.append(v)
|
self._log.append(v)
|
||||||
|
|
||||||
|
def reset_timestamp(self):
|
||||||
|
self.timestamp = None
|
||||||
|
|
||||||
class Writer(_FileLike):
|
class Writer(_FileLike):
|
||||||
def flush(self):
|
def flush(self):
|
||||||
@ -131,6 +134,7 @@ class Reader(_FileLike):
|
|||||||
raise NetLibDisconnect
|
raise NetLibDisconnect
|
||||||
except SSL.SysCallError, v:
|
except SSL.SysCallError, v:
|
||||||
raise NetLibDisconnect
|
raise NetLibDisconnect
|
||||||
|
self.timestamp = self.timestamp or time.time()
|
||||||
if not data:
|
if not data:
|
||||||
break
|
break
|
||||||
result += data
|
result += data
|
||||||
|
Loading…
Reference in New Issue
Block a user