diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-08 12:23:28 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-06-08 12:23:28 +0200 |
commit | 7b6a6cb94c8c2abc449351a1238227f9b10b0872 (patch) | |
tree | cc419ba50b1cbab369949c0be45ccc2e82c57dba /module/remote/SocketServer.py | |
parent | Fixed the YouPorn.com Plugin (diff) | |
download | pyload-7b6a6cb94c8c2abc449351a1238227f9b10b0872.tar.xz |
core able to push data to gui, proxy support: closed #1
Diffstat (limited to 'module/remote/SocketServer.py')
-rw-r--r-- | module/remote/SocketServer.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/module/remote/SocketServer.py b/module/remote/SocketServer.py index c519d8a3b..e5932bb6e 100644 --- a/module/remote/SocketServer.py +++ b/module/remote/SocketServer.py @@ -24,6 +24,20 @@ class ServerThread(threading.Thread): asyncore.loop() print "loop closed" + def sockets(self): + """returns all connected sockets in a list""" + sockets = [] + for value in asyncore.socket_map.values(): + if SecondaryServerSocket == value.__class__: + sockets.append(value) + + return sockets + + def push_all(self, obj): + """push obj to all sockets""" + for socket in self.sockets(): + socket.push_obj(obj) + class MainServerSocket(asyncore.dispatcher): def __init__(self, port, pycore): @@ -61,3 +75,6 @@ class SecondaryServerSocket(asynchat.async_chat): def handle_close(self): print "Disconnected from", self.getpeername() self.close() + def push_obj(self, obj): + obj = self.handler.encrypt(obj) + self.push(obj) |