def __init__(self, cfg, warebox, storage_cache, startup_synchronization, filesystem_watcher, linker, metadata_db, hashes_db, internal_facade, ui_controller, lockfile_fd, auto_start, input_queue, scheduler): """ @param cfg: Instance of filerockclient.config.ConfigManager. @param warebox: Instance of filerockclient.warebox.Warebox. @param storage_cache: Instance of filerockclient.databases.storage_cache. StorageCache. @param startup_synchronization: Instance of filerockclient.serversession. startup_synchronization. @param filesystem_watcher: Instance of any class in the filerockclient. filesystem_watcher package. @param linker: Instance of filerockclient.linker.Linker. @param metadata_db: Instance of filerockclient.databases.metadata. MetadataDB. @param hashes_db: Instance of filerockclient.databases.hashes.HashesDB. @param internal_facade: Instance of filerockclient.internal_facade. InternalFacade. @param ui_controller: Instance of filerockclient.ui.ui_controller. UIController. @param lockfile_fd: File descriptor of the lock file which ensures there is only one instance of FileRock Client running. Child processes have to close it to avoid stale locks. @param auto_start: Boolean flag telling whether ServerSession should connect to the server when started. @param input_queue: Instance of filerockclient.util.multi_queue. MultiQueue. It is expected to have the following queues: usercommand: Commands sent by the user sessioncommand: ServerSession internal use commands systemcommand: Commands sent by other client components servermessage: Messages sent by the server. operation: PathnameOperation objects to handle @param scheduler: Instance of filerockclient.util.scheduler.Scheduler. """ threading.Thread.__init__(self, name=self.__class__.__name__) self.logger = logging.getLogger("FR.%s" % self.__class__.__name__) self._input_queue = input_queue self.warebox = warebox self.startup_synchronization = startup_synchronization self.filesystem_watcher = filesystem_watcher self._internal_facade = internal_facade self._ui_controller = ui_controller self.metadataDB = metadata_db self.hashesDB = hashes_db self.auto_start = auto_start self._scheduler = scheduler self.storage_cache = storage_cache self.linker = linker self.warebox = warebox self.cfg = cfg self._lockfile_fd = lockfile_fd self._started = False self.must_die = threading.Event() # TODO: this flag exists due to auto-disconnection. It will be removed # and replaced by a CONNECTFORCE command as soon as ServerSession will # stop going automatically to DisconnectedState. self.disconnect_other_client = False self.operation_responses = {} self._pathname2id = {} self.output_message_queue = Queue.Queue() self.input_keepalive_queue = Queue.Queue() self.current_state = None self.reconnection_time = 1 self.num_connection_attempts = 0 self.max_connection_attempts = MAX_CONNECTION_ATTEMPTS self._basis_lock = threading.Lock() self.server_basis = None self.session_id = None self.storage_ip_address = None self.refused_declare_count = 0 self._current_basis = None self.id = 0 self._sync_operations = [] self.keepalive_timer = ConnectionLifeKeeper(self._input_queue, self.input_keepalive_queue, self.output_message_queue, True) self.transaction = Transaction() self.transaction_manager = TransactionManager(self.transaction, self.storage_cache) StateRegister.setup(self) self.client_id = None self.username = None self.priv_key = None self.host = None self.port = None self.server_certificate = None self.storage_hostname = None self.refused_declare_max = None self.refused_declare_waiting_time = None self.commit_threshold_seconds = None self.commit_threshold_operations = None self.commit_threshold_bytes = None self.transaction_cache = None self.integrity_manager = None self.cryptoAdapter = None self.temp_dir = None self.connection_reader = None self.connection_writer = None self.sock = None self.listening_operations = False self.reload_config_info()