From 6e36f1d7cdb60b2b4c71e70a5b3752f8c907f348 Mon Sep 17 00:00:00 2001 From: Thomas Keck Date: Fri, 12 Mar 2010 21:34:48 +0100 Subject: Fixed typos --- proxy.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'proxy.py') diff --git a/proxy.py b/proxy.py index 93c1994..77356f5 100644 --- a/proxy.py +++ b/proxy.py @@ -22,7 +22,7 @@ BLOCKSIZE_STEP = 512 * KB class Fetcher(asynchat.async_chat): def __init__(self, reader, endpoint, url, header, range): self.reader = reader - self.proxy = ENDPOINTS(endpoint) + self.proxy = ENDPOINTS[endpoint] self.url = url self.header = header self.range = range @@ -56,7 +56,7 @@ class Fetcher(asynchat.async_chat): self.pos += len(data) if self.pos >= self.range[1]: self.stop_time = time.time() - self.start_fetcher(endpoint, self.time()) + self.reader.start_fetcher(self.endpoint, self.time()) print self, "finished" self.close_when_done() elif self.state ==1: #header @@ -92,9 +92,11 @@ class MultipleProxyReader(object): self.write_pos = 0 self.buffer = "" self.blocks = dict() + self.endpoints_time = [] + self.endpoints_blocksize = [] for i in range(0,len(ENDPOINTS)): - self.endpoints_time.append(1) + self.endpoints_time.append(BLOCKSIZE_FETCH/(200*KB)) self.endpoints_blocksize.append(BLOCKSIZE_FETCH) for i in range(0,len(ENDPOINTS)): @@ -125,20 +127,20 @@ class MultipleProxyReader(object): self.find_next_data() self.endpoints_time[endpoint] = time - if max(self.endpoints_times[endpoint]) == time: - self.endpoint_blocksize[endpoint] += BLOCKSIZE_STEP - elif min(self.endpoints_times[endpoint]) == time: - self.endpoint_blocksize[endpoint] -= BLOCKSIZE_STEP + if max(self.endpoints_time) == time: + self.endpoints_blocksize[endpoint] += BLOCKSIZE_STEP + elif min(self.endpoints_time) == time: + self.endpoints_blocksize[endpoint] -= BLOCKSIZE_STEP if self.fetch_pos +1