pybitmessage.network.connectionpool module

BMConnectionPool class definition

class BMConnectionPool[source]

Bases: object

Pool of all existing connections

trustedPeer = None

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 expected use case is where the user has 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.

connections()

Shortcut for combined list of connections from inboundConnections and outboundConnections dicts

establishedConnections()

Shortcut for list of connections having fullyEstablished == True

connectToStream(streamNumber)

Connect to a bitmessage stream

getConnectionByAddr(addr)

Return an (existing) connection object based on a Peer object (IP and port)

isAlreadyConnected(nodeid)

Check if we’re already connected to this peer

addConnection(connection)

Add a connection object to our internal dict

removeConnection(connection)

Remove a connection from our internal dict

static getListeningIP()

What IP are we supposed to be listening on?

startListening(bind=None)

Open a listening socket and start accepting connections on it

startUDPSocket(bind=None)

Open an UDP socket. Depending on settings, it can either only accept incoming UDP packets, or also be able to send them.

startBootstrappers()

Run the process of resolving bootstrap hostnames

loop()

Main Connectionpool’s loop