1
0

Have queues passed to the network constructor.

This is somewhat cleaner as the proxy's pipe and network setup
was awkwardly interleaved.  It also means network's constructor
is free to use both; currently some code is working around the
fact that the response queue doesn't exist in the constructor.
This commit is contained in:
Neil Booth
2015-05-21 12:44:46 +09:00
parent cc17bb0090
commit bd781d600b
3 changed files with 11 additions and 10 deletions

View File

@@ -54,9 +54,9 @@ class NetworkProxy(util.DaemonThread):
self.pipe = util.SocketPipe(socket)
self.network = None
else:
self.network = Network(config)
self.pipe = util.QueuePipe(send_queue=self.network.requests_queue)
self.network.start(self.pipe.get_queue)
self.pipe = util.QueuePipe()
self.network = Network(self.pipe.send_queue, self.pipe.get_queue, config)
self.network.start()
for key in ['status','banner','updated','servers','interfaces']:
value = self.network.get_status_value(key)
self.pipe.get_queue.put({'method':'network.status', 'params':[key, value]})