Browse Source

Clean up imports; use self.print_error

283
Neil Booth 9 years ago
parent
commit
695aebaa80
  1. 16
      lib/network_proxy.py

16
lib/network_proxy.py

@ -22,11 +22,8 @@ import threading
import Queue import Queue
import util import util
from network import Network from network import Network, serialize_proxy, serialize_server
from util import print_error
from simple_config import SimpleConfig from simple_config import SimpleConfig
from network import serialize_proxy, serialize_server
class NetworkProxy(util.DaemonThread): class NetworkProxy(util.DaemonThread):
@ -87,7 +84,7 @@ class NetworkProxy(util.DaemonThread):
def process(self, response): def process(self, response):
if self.debug: if self.debug:
print_error("<--", response) self.print_error("<--", response)
if response.get('method') == 'network.status': if response.get('method') == 'network.status':
key, value = response.get('params') key, value = response.get('params')
@ -124,11 +121,12 @@ class NetworkProxy(util.DaemonThread):
callback = k callback = k
break break
else: else:
print_error( "received unexpected notification", method, params) self.print_error("received unexpected notification",
method, params)
return return
r = {'method':method, 'params':params, 'result':result,
r = {'method':method, 'params':params, 'result':result, 'id':msg_id, 'error':error} 'id':msg_id, 'error':error}
callback(r) callback(r)
@ -159,7 +157,7 @@ class NetworkProxy(util.DaemonThread):
ids.append(self.message_id) ids.append(self.message_id)
requests.append(request) requests.append(request)
if self.debug: if self.debug:
print_error("-->", request) self.print_error("-->", request)
self.message_id += 1 self.message_id += 1
self.pipe.send_all(requests) self.pipe.send_all(requests)

Loading…
Cancel
Save