def connecttobootstrap(self): connected = False for boottuple in self.bootstraplist: try: self.socket.close() self.socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) self.socket.connect(boottuple) self.conn = Connection(self.socket) self.conn.settimeout(CLIENTRESENDTIMEOUT) self.bootstrap = boottuple connected = True if self.debug: print "Connected to new bootstrap: ", boottuple break except socket.error, e: if self.debug: print "Socket.Error: ", e continue