def run(self):
queue = Queue()<EOL>process = UploadProcess(self._connection_settings, self._room, queue, self._files)<EOL>if self._data:<EOL><INDENT>process.add_data(self._data)<EOL><DEDENT>process.start()<EOL>if not process.is_alive():<EOL><INDENT>return<EOL><DEDENT>self._uploading = True<EOL>done = False<EOL>while not self._abort and not done:<EOL><INDENT>if not process.is_alive():<EOL><INDENT>self._abort = True<EOL>break<EOL><DEDENT>messages = None<EOL>try:<EOL><INDENT>data = queue.get()<EOL>if not data:<EOL><INDENT>done = True<EOL>if self._finished_callback:<EOL><INDENT>self._finished_callback()<EOL><DEDENT><DEDENT>elif isinstance(data, tuple):<EOL><INDENT>sent, total = data<EOL>if self._progress_callback:<EOL><INDENT>self._progress_callback(sent, total)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self._abort = True<EOL>if self._error_callback:<EOL><INDENT>self._error_callback(data, self._room)<EOL><DEDENT><DEDENT><DEDENT>except Empty:<EOL><INDENT>time.sleep(<NUM_LIT:0.5>)<EOL><DEDENT><DEDENT>self._uploading = False<EOL>if self._abort and not process.is_alive() and self._error_callback:<EOL><INDENT>self._error_callback(Exception("<STR_LIT>"), self._room)<EOL><DEDENT>queue.close()<EOL>if process.is_alive():<EOL><INDENT>queue.close()<EOL>process.terminate()<EOL><DEDENT>process.join()<EOL>
Called by the thread, it runs the process.

        NEVER call this method directly. Instead call start() to start the thread.

        Before finishing the thread using this thread, call join()