Simplify following on from prior dead code removal
This commit is contained in:
parent
f9547a194e
commit
fb5e8068ce
|
@ -534,8 +534,14 @@ class Network(util.DaemonThread):
|
||||||
self.pending_sends.append((messages, callback))
|
self.pending_sends.append((messages, callback))
|
||||||
|
|
||||||
def process_pending_sends(self):
|
def process_pending_sends(self):
|
||||||
sends = self.pending_sends
|
# Requests needs connectivity. If we don't have an interface,
|
||||||
self.pending_sends = []
|
# we cannot process them.
|
||||||
|
if not self.interface:
|
||||||
|
return
|
||||||
|
|
||||||
|
with self.lock:
|
||||||
|
sends = self.pending_sends
|
||||||
|
self.pending_sends = []
|
||||||
|
|
||||||
for messages, callback in sends:
|
for messages, callback in sends:
|
||||||
subs = filter(lambda (m,v): m.endswith('.subscribe'), messages)
|
subs = filter(lambda (m,v): m.endswith('.subscribe'), messages)
|
||||||
|
@ -544,30 +550,11 @@ class Network(util.DaemonThread):
|
||||||
if sub not in self.subscriptions[callback]:
|
if sub not in self.subscriptions[callback]:
|
||||||
self.subscriptions[callback].append(sub)
|
self.subscriptions[callback].append(sub)
|
||||||
|
|
||||||
unsent = []
|
for method, params in messages:
|
||||||
for message in messages:
|
if self.debug:
|
||||||
if not self.process_request(message, callback):
|
self.print_error("-->", request)
|
||||||
unsent.append(message)
|
message_id = self.queue_request(method, params)
|
||||||
|
self.unanswered_requests[message_id] = method, params, callback
|
||||||
if unsent:
|
|
||||||
with self.lock:
|
|
||||||
self.pending_sends.append((unsent, callback))
|
|
||||||
|
|
||||||
# FIXME: inline this function
|
|
||||||
def process_request(self, request, callback):
|
|
||||||
'''Returns true if the request was processed.'''
|
|
||||||
method, params = request
|
|
||||||
|
|
||||||
# This request needs connectivity. If we don't have an
|
|
||||||
# interface, we cannot process it.
|
|
||||||
if not self.interface:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if self.debug:
|
|
||||||
self.print_error("-->", request)
|
|
||||||
message_id = self.queue_request(method, params)
|
|
||||||
self.unanswered_requests[message_id] = method, params, callback
|
|
||||||
return True
|
|
||||||
|
|
||||||
def connection_down(self, server):
|
def connection_down(self, server):
|
||||||
'''A connection to server either went down, or was never made.
|
'''A connection to server either went down, or was never made.
|
||||||
|
|
Loading…
Reference in New Issue