def _loadTrustedPeer(): try: trustedPeer = BMConfigParser().get('bitmessagesettings', 'trustedpeer') except ConfigParser.Error: # This probably means the trusted peer wasn't specified so we # can just leave it as None return host, port = trustedPeer.split(':') state.trustedPeer = state.Peer(host, int(port))
def _loadTrustedPeer(): try: trustedPeer = BMConfigParser().get('bitmessagesettings', 'trustedpeer') except ConfigParser.Error: # This probably means the trusted peer wasn't specified so we # can just leave it as None return try: host, port = trustedPeer.split(':') except ValueError: sys.exit('Bad trustedpeer config setting! It should be set as' ' trustedpeer=<hostname>:<portnumber>') state.trustedPeer = state.Peer(host, int(port))
def __init__(self): asyncore.set_rates( BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"), BMConfigParser().safeGetInt("bitmessagesettings", "maxuploadrate")) self.outboundConnections = {} self.inboundConnections = {} self.listeningSockets = {} self.udpSockets = {} self.streams = [] self._lastSpawned = 0 self._spawnWait = 2 self._bootstrapped = False trustedPeer = BMConfigParser().safeGet('bitmessagesettings', 'trustedpeer') try: if trustedPeer: host, port = trustedPeer.split(':') self.trustedPeer = Peer(host, int(port)) except ValueError: sys.exit('Bad trustedpeer config setting! It should be set as' ' trustedpeer=<hostname>:<portnumber>')