summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-28 14:52:22 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-28 14:52:22 +0200
commit88227131086768d62f26be330f3101924ebbb50e (patch)
treea3b1e2582080d065281e7297b2236612944124ae /module
parentclean up some code, new config parser, basic time shedule (diff)
downloadpyload-88227131086768d62f26be330f3101924ebbb50e.tar.xz
time shedule fix
Diffstat (limited to 'module')
-rwxr-xr-xmodule/network/Request.py2
-rw-r--r--module/remote/SocketServer.py (renamed from module/socket/SocketServer.py)39
-rw-r--r--module/remote/__init__.py1
3 files changed, 21 insertions, 21 deletions
diff --git a/module/network/Request.py b/module/network/Request.py
index 07c1769ec..86449a4f2 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -83,7 +83,7 @@ class Request:
return output
- def addAuth(self, user, pw):
+ def add_auth(self, user, pw):
self.downloader.addheaders.append(['Authorization','Basic ' + base64.encodestring(user + ':' + pw)[:-1]])
diff --git a/module/socket/SocketServer.py b/module/remote/SocketServer.py
index 5466195e8..4469f89ac 100644
--- a/module/socket/SocketServer.py
+++ b/module/remote/SocketServer.py
@@ -6,52 +6,51 @@ authored by: RaNaN
This modul class handels all incoming and outgoing data between server and gui
"""
-import threading
-import socket
-import asyncore
import asynchat
+import asyncore
+import socket
+import threading
-class ServerThread(threading.Thread):
-
- def __init__(self):
- threading.Thread.__init__ (self)
- self.server = MainServerSocket(7272)
- def run(self):
- asyncore.loop()
-
- def stop(self):
- asyncore.socket_map.clear()
- self.server.close()
+class ServerThread(threading.Thread):
+ def __init__(self, pycore):
+ threading.Thread.__init__(self)
+ self.setDaemon(True)
+ self.server = MainServerSocket(7272, pycore)
+
+ def run(self):
+ asyncore.loop()
+ print "loop closed"
class MainServerSocket(asyncore.dispatcher):
- def __init__(self, port):
+ def __init__(self, port, pycore):
print 'initing MSS'
asyncore.dispatcher.__init__(self)
+ self.pycore = pycore
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
- self.bind(('',port))
+ self.bind(('localhost', port))
self.listen(5)
def handle_accept(self):
newSocket, address = self.accept()
print "Connected from", address
- SecondaryServerSocket(newSocket)
+ SecondaryServerSocket(newSocket, self.pycore)
def handle_close(self):
print "going to close"
self.close()
-
class SecondaryServerSocket(asynchat.async_chat):
- def __init__(self, *args):
+ def __init__(self, pycore, *args):
print 'initing SSS'
+ self.pycore = pycore
asynchat.async_chat.__init__(self, *args)
self.set_terminator('\n')
self.data = []
def collect_incoming_data(self, data):
self.data.append(data)
def found_terminator(self):
- self.push(''.join(self.data))
+ self.push("daten")
self.data = []
#having fun with the data
def handle_close(self):
diff --git a/module/remote/__init__.py b/module/remote/__init__.py
new file mode 100644
index 000000000..8d1c8b69c
--- /dev/null
+++ b/module/remote/__init__.py
@@ -0,0 +1 @@
+