def __init__(self, config): self.config = config self.socket = s.socket(s.AF_INET, s.SOCK_STREAM) if platform.system != "Windows": # This ensures we don't need to wait for a timeout every time this # process exits and then starts and tries to bind to this port again self.socket.setsockopt(s.SOL_SOCKET, s.SO_REUSEADDR, 1L) self.socket.bind(("",self.config.port)) self.socket.listen(5) self.threads = [] task = util.ThreadLauncher(self.pinger, self.handle_control_c, respawn=True) task.start() self.peer_lock = threading.RLock() self.peer_ips = {} self.mm = Matchmaker(self) self.one_forgery = False # for debugging self.special_forgery_debugging = False if self.special_forgery_debugging and not Reconciliator.hash_archival: raise ValueError, "cannot do special debugging without special archival"