summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rwxr-xr-xmodule/network/Request.py5
-rw-r--r--module/thread_list.py8
2 files changed, 6 insertions, 7 deletions
diff --git a/module/network/Request.py b/module/network/Request.py
index 8725d0607..1bf8c8255 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -102,7 +102,10 @@ class Request:
file = open(filename, 'wb')
req = urllib2.Request(url)
conn = self.downloader.open(req, post)
- self.dl_size = int(conn.headers["content-length"])
+ if conn.headers.has_key("content-length"):
+ self.dl_size = int(conn.headers["content-length"])
+ else:
+ self.dl_size = 0
self.dl_arrived = 0
self.dl_time = time.time()
for chunk in conn:
diff --git a/module/thread_list.py b/module/thread_list.py
index 531bc7401..dc77c6730 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -18,6 +18,7 @@
#
###
#python
+from __future__ import with_statement
import re
import subprocess
import time
@@ -125,7 +126,6 @@ class Thread_List(object):
with open(self.parent.config['failed_file'], 'a') as f:
f.write(pyfile.url+"\n")
-
self.lock.release()
return True
@@ -151,15 +151,12 @@ class Thread_List(object):
if self.reconnecting:
return False
-
+
self.lock.acquire()
if self.check_reconnect():
-
self.reconnecting = True
-
self.reconnect()
-
time.sleep(1.1)
self.reconnecting = False
@@ -185,7 +182,6 @@ class Thread_List(object):
else:
return False
-
def reconnect(self):
reconn = subprocess.Popen(self.parent.config['reconnectMethod'])
reconn.wait()