Skip to content
Browse files

moved send logic to Transport

  • Loading branch information...
1 parent 842d652 commit bb543e072e499fee156bccd5f47805736618dbae @m0mchil committed Sep 27, 2012
Showing with 12 additions and 12 deletions.
  1. +1 −4 HttpTransport.py
  2. +1 −7 StratumTransport.py
  3. +10 −1 Transport.py
View
5 HttpTransport.py
@@ -51,10 +51,7 @@ def loop(self):
self.queue_work(work, miner)
miner = self.servers.updatable_miner()
- while not self.result_queue.empty():
- result = self.result_queue.get(False)
- with self.servers.lock:
- self.servers.send(result, self.send_internal)
+ self.process_result_queue()
sleep(1)
except Exception:
say_exception("Unexpected error:")
View
8 StratumTransport.py
@@ -101,13 +101,7 @@ def loop(self):
continue
with self.send_lock:
- while not self.result_queue.empty():
- result = self.result_queue.get(False)
- #if not self.send(result):
- if not self.servers.send(result, self.send_internal):
- self.result_queue.put(result)
- self.stop()
- break
+ self.process_result_queue()
sleep(1)
def asyncore_thread(self):
View
11 Transport.py
@@ -18,4 +18,13 @@ def loop(self):
def check_failback(self):
if self.servers.server_index != 0 and time() - self.last_failback > self.options.failback:
self.stop()
- return True
+ return True
+
+ def process_result_queue(self):
+ while not self.result_queue.empty():
+ result = self.result_queue.get(False)
+ with self.servers.lock:
+ if not self.servers.send(result, self.send_internal):
+ self.result_queue.put(result)
+ self.stop()
+ break

0 comments on commit bb543e0

Please sign in to comment.
Something went wrong with that request. Please try again.