示例#1
0
 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()
示例#2
0
 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:]
示例#3
0
文件: proxy.py 项目: svn2github/Xpra
 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()
示例#4
0
文件: fdproxy.py 项目: ljmljz/xpra
 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()
示例#5
0
 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()