PyBitmessage/src/state.py

71 lines
2.1 KiB
Python
Raw Normal View History

import collections
neededPubkeys = {}
streamsInWhichIAmParticipating = []
2018-04-18 10:34:12 +00:00
sendDataQueues = [] # each sendData thread puts its queue in this list.
# For UPnP
extPort = None
# for Tor hidden service
socksIP = None
2017-01-12 18:18:56 +00:00
# Network protocols availability, initialised below
networkProtocolAvailability = None
2018-04-18 10:34:12 +00:00
appdata = '' # holds the location of the application data storage directory
2018-04-18 10:34:12 +00:00
# Set to 1 by the doCleanShutdown function.
# Used to tell the proof of work worker threads to exit.
shutdown = 0
2018-04-09 04:38:48 +00:00
# Component control flags - set on startup, do not change during runtime
# The defaults are for standalone GUI (default operating mode)
2018-04-18 10:34:12 +00:00
enableNetwork = True # enable network threads
enableObjProc = True # enable object processing threads
enableAPI = True # enable API (if configured)
enableGUI = True # enable GUI (QT or ncurses)
enableSTDIO = False # enable STDIO threads
2017-02-02 14:48:56 +00:00
curses = False
2018-04-18 10:34:12 +00:00
sqlReady = False # set to true by sqlTread when ready for processing
maximumNumberOfHalfOpenConnections = 0
invThread = None
addrThread = None
downloadThread = None
ownAddresses = {}
# If the trustedpeer option is specified in keys.dat then this will
# contain a Peer which will be connected to instead of using the
# addresses advertised by other peers. The client will only connect to
# this peer and the timing attack mitigation will be disabled in order
# to download data faster. The expected use case is where the user has
# a fast connection to a trusted server where they run a BitMessage
# daemon permanently. If they then run a second instance of the client
# on a local machine periodically when they want to check for messages
# it will sync with the network a lot faster without compromising
# security.
trustedPeer = None
discoveredPeers = {}
# tracking pending downloads globally, for stats
missingObjects = {}
Peer = collections.namedtuple('Peer', ['host', 'port'])
2017-01-12 18:18:56 +00:00
2018-04-18 10:34:12 +00:00
2017-01-12 18:18:56 +00:00
def resetNetworkProtocolAvailability():
global networkProtocolAvailability
networkProtocolAvailability = {'IPv4': None, 'IPv6': None, 'onion': None}
2018-04-18 10:34:12 +00:00
2017-01-12 18:18:56 +00:00
resetNetworkProtocolAvailability()
dandelion = 0
testmode = False