def _copy_loop(self, log_name, from_conn, to_conn): #log("XpraProxy._copy_loop(%s, %s, %s)", log_name, from_conn, to_conn) try: while not self._closed: log("%s: waiting for data", log_name) buf = untilConcludes(self.is_active, noretry, from_conn.read, PROXY_BUFFER_SIZE) if not buf: log("%s: connection lost", log_name) return if SHOW_DATA: log("%s: %s bytes: %s", log_name, len(buf), repr_ellipsized(buf)) log("%s: %s", log_name, repr_ellipsized(hexstr(buf))) while buf and not self._closed: log("%s: writing %s bytes", log_name, len(buf)) written = untilConcludes(self.is_active, noretry, to_conn.write, buf) buf = buf[written:] log("%s: written %s bytes", log_name, written) log("%s copy loop ended", log_name) except Exception as e: log("%s: %s", log_name, e) finally: self.quit()
def _copy_loop(self, log_name, from_conn, to_conn): while not self._closed: log("%s: waiting for data", log_name) buf = untilConcludes(from_conn.read, 4096) if not buf: log("%s: connection lost", log_name) self.quit() return while buf and not self._closed: log("%s: writing %s bytes", log_name, len(buf)) written = untilConcludes(to_conn.write, buf) buf = buf[written:]
def _copy_loop(self, log_name, from_conn, to_conn): debug("XpraProxy._copy_loop(%s, %s, %s)", log_name, from_conn, to_conn) try: while not self._closed: debug("%s: waiting for data", log_name) buf = untilConcludes(self.is_active, from_conn.read, 4096) if not buf: debug("%s: connection lost", log_name) self.quit() return while buf and not self._closed: debug("%s: writing %s bytes", log_name, len(buf)) written = untilConcludes(self.is_active, to_conn.write, buf) buf = buf[written:] except Exception, e: debug("%s: %s", log_name, e) self.quit()
def _copy_loop(self, log_name, from_conn, to_conn): #log("XpraProxy._copy_loop(%s, %s, %s)", log_name, from_conn, to_conn) try: while not self._closed: log("%s: waiting for data", log_name) buf = untilConcludes(self.is_active, from_conn.read, PROXY_BUFFER_SIZE) if not buf: log("%s: connection lost", log_name) return if SHOW_DATA: log("%s: %s bytes: %s", log_name, len(buf), repr_ellipsized(buf)) log("%s: %s", log_name, repr_ellipsized(binascii.hexlify(buf))) while buf and not self._closed: log("%s: writing %s bytes", log_name, len(buf)) written = untilConcludes(self.is_active, to_conn.write, buf) buf = buf[written:] log("%s: written %s bytes", log_name, written) except Exception as e: log("%s: %s", log_name, e) self.quit()
def _copy_loop(self, log_name, from_conn, to_conn): #log("XpraProxy._copy_loop(%s, %s, %s)", log_name, from_conn, to_conn) try: while not self._closed: log("%s: waiting for data", log_name) buf = untilConcludes(self.is_active, from_conn.read, 65536) if not buf: log("%s: connection lost", log_name) return if SHOW_DATA: log("%s: %s bytes: %s", log_name, len(buf), repr_ellipsized(buf)) log("%s: %s", log_name, repr_ellipsized(binascii.hexlify(buf))) while buf and not self._closed: log("%s: writing %s bytes", log_name, len(buf)) written = untilConcludes(self.is_active, to_conn.write, buf) buf = buf[written:] log("%s: written %s bytes", log_name, written) except Exception as e: log("%s: %s", log_name, e) self.quit()