summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves <yvesf-git@xapek.org>2010-03-12 20:26:17 +0100
committerYves <yvesf-git@xapek.org>2010-03-12 20:26:17 +0100
commitb35fa3d8fe84b625756a3eee9518617998682244 (patch)
tree8f72c71dba423740b0d7c326e2c6e68a19f0e668
parent3ee06e0857618c43dda0f90ed770d67f58b291bc (diff)
parent6228e190d840b566a84ea64618a5f8602de5e32e (diff)
downloadmagicproxy-b35fa3d8fe84b625756a3eee9518617998682244.tar.gz
magicproxy-b35fa3d8fe84b625756a3eee9518617998682244.zip
Merge branch 'master' of git@github.com:yvesf/magicproxy
-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