Browse Source

Merge pull request #1189 from kyuupichan/if-cleanup

First of several incremental patches tightening up interface.py.
283
ThomasV 10 years ago
parent
commit
5e2e82d516
  1. 2
      gui/qt/main_window.py
  2. 25
      lib/interface.py
  3. 2
      scripts/servers

2
gui/qt/main_window.py

@ -38,7 +38,7 @@ import icons_rc
from electrum.util import format_satoshis, format_time, NotEnoughFunds, StoreDict
from electrum import Transaction
from electrum import mnemonic
from electrum import util, bitcoin, commands, Interface, Wallet
from electrum import util, bitcoin, commands, Wallet
from electrum import SimpleConfig, Wallet, WalletStorage
from electrum import Imported_Wallet

25
lib/interface.py

@ -17,28 +17,33 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import random, ast, re, errno, os
import threading, traceback, sys, time, json, Queue
import re, errno, os
import threading, traceback, sys, time, Queue
import socket
import ssl
import x509
import util
import requests
ca_path = requests.certs.where()
from version import ELECTRUM_VERSION, PROTOCOL_VERSION
import util
from simple_config import SimpleConfig
import x509
import util
DEFAULT_TIMEOUT = 5
def Interface(server, config = None):
"""Interface factory function. The returned interface class handles the connection
to a single remote electrum server. The object handles all necessary locking. It's
exposed API is:
- Inherits everything from threading.Thread.
- Member functions start(), send_request(), stop()
- Member variables is_connected, server.
"is_connected" is currently racy. "server" is constant for the object's lifetime and hence
synchronization is unnecessary.
"""
host, port, protocol = server.split(':')
port = int(port)
if protocol in 'st':
return TcpInterface(server, config)
else:

2
scripts/servers

@ -1,6 +1,6 @@
#!/usr/bin/env python
from electrum import Interface, SimpleConfig, set_verbosity
from electrum import SimpleConfig, set_verbosity
from electrum.network import DEFAULT_SERVERS, filter_protocol
import time, Queue
from collections import defaultdict

Loading…
Cancel
Save