From: thomasv Date: Fri, 12 Oct 2012 14:09:20 +0000 (+0200) Subject: move init_socket in constructor X-Git-Url: https://git.novaco.in/?p=electrum-nvc.git;a=commitdiff_plain;h=1a781036cf0a3d04c5e170ef71fbf3e36c2ab908 move init_socket in constructor --- diff --git a/lib/interface.py b/lib/interface.py index 1f64278..ddb6a0c 100644 --- a/lib/interface.py +++ b/lib/interface.py @@ -60,8 +60,6 @@ class InterfaceAncestor(threading.Thread): self.responses = Queue.Queue() self.unanswered_requests = {} - def init_socket(self): - pass def poke(self): # push a fake response so that the getting thread exits its loop @@ -210,6 +208,7 @@ class TcpStratumInterface(InterfaceAncestor): def __init__(self, host, port, proxy=None): InterfaceAncestor.__init__(self, host, port, proxy) + self.init_socket() def init_socket(self): global proxy_modes @@ -435,7 +434,6 @@ class WalletSynchronizer(threading.Thread): def start_interface(self): - self.interface.init_socket() self.interface.start() if self.interface.is_connected: self.wallet.start_session(self.interface) diff --git a/scripts/blocks b/scripts/blocks index dfa8919..8f7500d 100755 --- a/scripts/blocks +++ b/scripts/blocks @@ -1,9 +1,9 @@ #!/usr/bin/env python -from electrum import Interface +import electrum + +i = electrum.Interface({'server':'electrum.novit.ro:50001:t'}) -i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('blockchain.numblocks.subscribe',[])]) diff --git a/scripts/get_history b/scripts/get_history index 0a8ca08..c680098 100755 --- a/scripts/get_history +++ b/scripts/get_history @@ -10,7 +10,6 @@ except: sys.exit(1) i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('blockchain.address.get_history',[addr])]) diff --git a/scripts/merchant.py b/scripts/merchant.py index 409ea56..7334abf 100644 --- a/scripts/merchant.py +++ b/scripts/merchant.py @@ -158,7 +158,6 @@ if __name__ == '__main__': conn = mdb.connect(db_instance, db_user, db_password, db_name); i = Interface({'server':"%s:%d:t"%(electrum_server, 50001)}) - i.init_socket() i.start() diff --git a/scripts/peers b/scripts/peers index c3cb02e..b3656ef 100755 --- a/scripts/peers +++ b/scripts/peers @@ -3,7 +3,6 @@ from electrum import Interface i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('server.peers.subscribe',[])]) diff --git a/scripts/watch_address b/scripts/watch_address index a8763c7..7c21ee9 100755 --- a/scripts/watch_address +++ b/scripts/watch_address @@ -10,7 +10,6 @@ except: sys.exit(1) i = Interface({'server':'electrum.novit.ro:50001:t'}) -i.init_socket() i.start() i.send([('blockchain.address.subscribe',[addr])])