summaryrefslogtreecommitdiffstats
path: root/module/network/XDCCRequest.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/network/XDCCRequest.py')
-rw-r--r--module/network/XDCCRequest.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/module/network/XDCCRequest.py b/module/network/XDCCRequest.py
index 01015cc62..92ccb4839 100644
--- a/module/network/XDCCRequest.py
+++ b/module/network/XDCCRequest.py
@@ -20,6 +20,7 @@
import socket
import re
+from os import remove
from os.path import exists
from time import time
@@ -27,8 +28,8 @@ from time import time
import struct
from select import select
-class XDCCError(Exception):
- pass
+from module.plugins.Plugin import Abort
+
class XDCCRequest():
def __init__(self, timeout=30, proxies={}):
@@ -88,7 +89,10 @@ class XDCCRequest():
# recv loop for dcc socket
while True:
if self.abort:
- break
+ dccsock.close()
+ fh.close()
+ remove(filename)
+ raise Abort()
data = dccsock.recv(4096)
dataLen = len(data)
@@ -121,6 +125,9 @@ class XDCCRequest():
return filename
+ def abortDownloads(self):
+ self.abort = True
+
@property
def size(self):
return self.filesize