summaryrefslogtreecommitdiffstats
path: root/module/network
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2012-02-05 15:53:40 +0100
committerGravatar Jeix <devnull@localhost> 2012-02-05 15:53:40 +0100
commitf631eda05ca45b7b503bb26aca746d735165d308 (patch)
tree92d087034eefd501bbdd875001d3e337a40ab99e /module/network
parentTreat most errors as tempfailures, this will solve the missing errors. (diff)
downloadpyload-f631eda05ca45b7b503bb26aca746d735165d308.tar.xz
xdcc fix
Diffstat (limited to 'module/network')
-rw-r--r--module/network/XDCCRequest.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/module/network/XDCCRequest.py b/module/network/XDCCRequest.py
index 92ccb4839..f03798c17 100644
--- a/module/network/XDCCRequest.py
+++ b/module/network/XDCCRequest.py
@@ -63,8 +63,9 @@ class XDCCRequest():
return socket.socket()
- def download(self, ip, port, filename, progressNotify=None):
+ def download(self, ip, port, filename, irc, progressNotify=None):
+ ircbuffer = ""
lastUpdate = time()
cumRecvLen = 0
@@ -94,6 +95,8 @@ class XDCCRequest():
remove(filename)
raise Abort()
+ self._keepAlive(irc, ircbuffer)
+
data = dccsock.recv(4096)
dataLen = len(data)
self.recv += dataLen
@@ -124,7 +127,21 @@ class XDCCRequest():
return filename
-
+ def _keepAlive(self, sock, readbuffer):
+ fdset = select([sock], [], [], 0)
+ if sock not in fdset[0]:
+ return
+
+ readbuffer += sock.recv(1024)
+ temp = readbuffer.split("\n")
+ readbuffer = temp.pop()
+
+ for line in temp:
+ line = line.rstrip()
+ first = line.split()
+ if first[0] == "PING":
+ sock.send("PONG %s\r\n" % first[1])
+
def abortDownloads(self):
self.abort = True