summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--proxy.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/proxy.py b/proxy.py
index c045bbd..0fbb199 100644
--- a/proxy.py
+++ b/proxy.py
@@ -25,6 +25,8 @@ class Fetcher(asynchat.async_chat):
self.header = self.header
self.range = range
+ self.start_time = time.time()
+
self.pos = range[0]
asynchat.async_chat.__init__(self)
self.set_terminator("\r\n")
@@ -41,13 +43,17 @@ class Fetcher(asynchat.async_chat):
#XXX self.header
self.send("Range: bytes=%s-%s\r\n" % (self.range[0], self.range[1]))
self.send("\r\n")
-
+
+ def time(self):
+ return self.stop_time - self.start_time
+
def collect_incoming_data(self, data):
if self.state==2: #body
self.reader.handle_incoming_data(self.pos, data)
self.pos += len(data)
if self.pos >= self.range[1]:
self.reader.finished()
+ self.stop_time = time.time()
print self, "finished"
self.close_when_done()
elif self.state ==1: #header