URI: 
       tMerge pull request #1231 from kyuupichan/if-add-remove - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 16b23a18324e96f3eab0093594a327adcc26eb9d
   DIR parent 0b201d98ab379c625193e54cadd6ae18cdf3826b
  HTML Author: ThomasV <electrumdev@gmail.com>
       Date:   Fri, 22 May 2015 08:33:13 +0200
       
       Merge pull request #1231 from kyuupichan/if-add-remove
       
       Absorb add_interface and remove_interface
       Diffstat:
         M lib/network.py                      |      20 +++++++-------------
       
       1 file changed, 7 insertions(+), 13 deletions(-)
       ---
   DIR diff --git a/lib/network.py b/lib/network.py
       t@@ -402,14 +402,6 @@ class Network(util.DaemonThread):
                self.recent_servers = self.recent_servers[0:20]
                self.save_recent_servers()
        
       -    def add_interface(self, i):
       -        self.interfaces[i.server] = i
       -        self.notify('interfaces')
       -
       -    def remove_interface(self, i):
       -        self.interfaces.pop(i.server)
       -        self.notify('interfaces')
       -
            def new_blockchain_height(self, blockchain_height, i):
                if self.is_connected():
                    if self.server_is_lagging():
       t@@ -419,23 +411,25 @@ class Network(util.DaemonThread):
                self.notify('updated')
        
            def process_if_notification(self, i):
       +        '''Handle interface addition and removal through notifications'''
                if i.server in self.pending_servers:
                    self.pending_servers.remove(i.server)
        
                if i.is_connected():
       -            self.add_interface(i)
       +            self.interfaces[i.server] = i
                    self.add_recent_server(i)
                    i.send_request({'method':'blockchain.headers.subscribe','params':[]})
                    if i.server == self.default_server:
                        self.switch_to_interface(i.server)
                else:
       -            if i.server in self.interfaces:
       -                self.remove_interface(i)
       -            if i.server in self.heights:
       -                self.heights.pop(i.server)
       +            self.interfaces.pop(i.server, None)
       +            self.heights.pop(i.server, None)
                    if i == self.interface:
                        self.set_status('disconnected')
                    self.disconnected_servers.add(i.server)
       +        # Our set of interfaces changed
       +        self.notify('interfaces')
       +
        
            def process_response(self, i, response):
                # the id comes from the daemon or the network proxy