URI: 
       tfix synchronizer hanging when not connected. - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit a4cb70649d1c1a144f28561a261b237875680094
   DIR parent c3cba786593b28d3c9d9d2084d61eea8b89f0461
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sat, 14 Mar 2015 08:43:43 +0100
       
       fix synchronizer hanging when not connected.
       
       Diffstat:
         M lib/blockchain.py                   |       6 ++++--
         M lib/network.py                      |       6 ++----
         M lib/network_proxy.py                |       3 +--
         M lib/synchronizer.py                 |       5 ++++-
         M lib/util.py                         |       3 +++
         M lib/verifier.py                     |       7 ++++---
       
       6 files changed, 18 insertions(+), 12 deletions(-)
       ---
   DIR diff --git a/lib/blockchain.py b/lib/blockchain.py
       t@@ -41,7 +41,7 @@ class Blockchain(util.DaemonThread):
            def run(self):
                self.init_headers_file()
                self.set_local_height()
       -        print_error( "blocks:", self.local_height )
       +        self.print_error("%d blocks"%self.local_height)
        
                while self.is_running():
                    try:
       t@@ -77,6 +77,8 @@ class Blockchain(util.DaemonThread):
                            continue
                    self.network.new_blockchain_height(height, i)
        
       +        self.print_error("stopped")
       +
        
            def verify_chain(self, chain):
        
       t@@ -267,7 +269,7 @@ class Blockchain(util.DaemonThread):
                i.send_request({'method':'blockchain.block.get_header', 'params':[h]}, queue)
        
            def retrieve_request(self, queue):
       -        while True:
       +        while self.is_running():
                    try:
                        ir = queue.get(timeout=1)
                    except Queue.Empty:
   DIR diff --git a/lib/network.py b/lib/network.py
       t@@ -166,10 +166,6 @@ class Network(util.DaemonThread):
                self.requests_queue = Queue.Queue()
                self.set_proxy(deserialize_proxy(self.config.get('proxy')))
        
       -
       -    def print_error(self, *msg):
       -        util.print_error("[network]", *msg)
       -
            def get_server_height(self):
                return self.heights.get(self.default_server, 0)
        
       t@@ -502,6 +498,8 @@ class Network(util.DaemonThread):
                for i in self.interfaces.values():
                    i.stop()
        
       +        self.print_error("stopped")
       +
        
            def on_header(self, i, r):
                result = r.get('result')
   DIR diff --git a/lib/network_proxy.py b/lib/network_proxy.py
       t@@ -78,11 +78,10 @@ class NetworkProxy(util.DaemonThread):
                    if response is None:
                        break
                    self.process(response)
       -
                self.trigger_callback('stop')
                if self.network:
                    self.network.stop()
       -        print_error("NetworkProxy: terminating")
       +        self.print_error("stopped")
        
            def process(self, response):
                if self.debug:
   DIR diff --git a/lib/synchronizer.py b/lib/synchronizer.py
       t@@ -49,8 +49,9 @@ class WalletSynchronizer(util.DaemonThread):
        
            def run(self):
                while self.is_running():
       -            while not self.network.is_connected():
       +            if not self.network.is_connected():
                        time.sleep(0.1)
       +                continue
                    self.run_interface()
        
            def run_interface(self):
       t@@ -183,3 +184,5 @@ class WalletSynchronizer(util.DaemonThread):
                        # Updated gets called too many times from other places as well; if we use that signal we get the notification three times
                        self.network.trigger_callback("new_transaction")
                        self.was_updated = False
       +
       +        self.print_error("stopped")
   DIR diff --git a/lib/util.py b/lib/util.py
       t@@ -43,6 +43,9 @@ class DaemonThread(threading.Thread):
                with self.running_lock:
                    self.running = False
        
       +    def print_error(self, *msg):
       +        print_error("[%s]"%self.__class__.__name__, *msg)
       +
        
        
        is_verbose = False
   DIR diff --git a/lib/verifier.py b/lib/verifier.py
       t@@ -97,13 +97,12 @@ class TxVerifier(util.DaemonThread):
                                if self.network.send([ ('blockchain.transaction.get_merkle',[tx_hash, tx_height]) ], self.queue.put):
                                    print_error('requesting merkle', tx_hash)
                                    requested_merkle.append(tx_hash)
       -
                    try:
                        r = self.queue.get(timeout=0.1)
                    except Queue.Empty:
                        continue
       -
       -            if not r: continue
       +            if not r:
       +                continue
        
                    if r.get('error'):
                        print_error('Verifier received an error:', r)
       t@@ -118,6 +117,8 @@ class TxVerifier(util.DaemonThread):
                        tx_hash = params[0]
                        self.verify_merkle(tx_hash, result)
        
       +        self.print_error("stopped")
       +
        
            def verify_merkle(self, tx_hash, result):
                tx_height = result.get('block_height')