MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / handle_accept

Method handle_accept

src/network/tcp.py:287–304  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

285 return False
286
287 def handle_accept(self):
288 pair = self.accept()
289 if pair is not None:
290 sock, addr = pair
291 state.ownAddresses[state.Peer(sock.getsockname()[0], sock.getsockname()[1])] = True
292 if len(network.connectionpool.BMConnectionPool().inboundConnections) + \
293 len(network.connectionpool.BMConnectionPool().outboundConnections) > \
294 BMConfigParser().safeGetInt("bitmessagesettings", "maxtotalconnections") + \
295 BMConfigParser().safeGetInt("bitmessagesettings", "maxbootstrapconnections") + 10:
296 # 10 is a sort of buffer, in between it will go through the version handshake
297 # and return an error to the peer
298 logger.warning("Server full, dropping connection")
299 sock.close()
300 return
301 try:
302 network.connectionpool.BMConnectionPool().addConnection(TCPConnection(sock=sock))
303 except socket.error:
304 pass
305
306
307if __name__ == "__main__":

Callers

nothing calls this directly

Calls 6

BMConfigParserClass · 0.90
TCPConnectionClass · 0.85
safeGetIntMethod · 0.80
addConnectionMethod · 0.80
acceptMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected