MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / setup

Method setup

src/class_receiveDataThread.py:53–83  ·  view source on GitHub ↗
(
        self,
        sock,
        HOST,
        port,
        streamNumber,
        selfInitiatedConnections,
        sendDataThreadQueue,
        objectHashHolderInstance)

Source from the content-addressed store, hash-verified

51 self.verackReceived = False
52
53 def setup(
54 self,
55 sock,
56 HOST,
57 port,
58 streamNumber,
59 selfInitiatedConnections,
60 sendDataThreadQueue,
61 objectHashHolderInstance):
62
63 self.sock = sock
64 self.peer = state.Peer(HOST, port)
65 self.name = "receiveData-" + self.peer.host.replace(":", ".") # ":" log parser field separator
66 self.streamNumber = state.streamsInWhichIAmParticipating
67 self.remoteStreams = []
68 self.selfInitiatedConnections = selfInitiatedConnections
69 self.sendDataThreadQueue = sendDataThreadQueue # used to send commands and data to the sendDataThread
70 self.hostIdent = self.peer.port if ".onion" in BMConfigParser().get('bitmessagesettings', 'onionhostname') and protocol.checkSocksIP(self.peer.host) else self.peer.host
71 shared.connectedHostsList[
72 self.hostIdent] = 0 # The very fact that this receiveData thread exists shows that we are connected to the remote host. Let's add it to this list so that an outgoingSynSender thread doesn't try to connect to it.
73 self.connectionIsOrWasFullyEstablished = False # set to true after the remote node and I accept each other's version messages. This is needed to allow the user interface to accurately reflect the current number of connections.
74 self.services = 0
75 if streamNumber == -1: # This was an incoming connection. Send out a version message if we accept the other node's version message.
76 self.initiatedConnection = False
77 else:
78 self.initiatedConnection = True
79 for stream in self.streamNumber:
80 self.selfInitiatedConnections[stream][self] = 0
81 self.objectHashHolderInstance = objectHashHolderInstance
82 self.downloadQueue = PendingDownloadQueue()
83 self.startTime = time.time()
84
85 def run(self):
86 logger.debug('receiveDataThread starting. ID ' + str(id(self)) + '. The size of the shared.connectedHostsList is now ' + str(len(shared.connectedHostsList)))

Callers

nothing calls this directly

Calls 3

BMConfigParserClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected