xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #838: proxy-network-debugging.patch

File proxy-network-debugging.patch, 3.2 KB (added by Antoine Martin, 6 years ago)

adds debugging to the low level network code

  • xpra/net/bytestreams.py

     
    6666        TTY_WRITE = win32ttywrite
    6767
    6868
    69 def untilConcludes(is_active_cb, f, *a, **kw):
     69def untilConcludes(is_active_cb, info, f, *a, **kw):
    7070    wait = 0
    7171    while is_active_cb():
    7272        try:
    7373            return f(*a, **kw)
    7474        except socket.timeout as e:
    75             log("untilConcludes(%s, %s, %s, %s) %s", is_active_cb, f, a, kw, e)
     75            log("untilConcludes(%s, %s, %s, %s, %s) %s", is_active_cb, info, f, a, kw, e)
    7676            continue
    7777        except (IOError, OSError) as e:
    7878            code = e.args[0]
    7979            can_continue = CONTINUE.get(code)
    8080            if can_continue:
    81                 log("untilConcludes(%s, %s, %s, %s) %s / %s (continue)", is_active_cb, f, a, kw, can_continue, e)
     81                log("untilConcludes(%s, %s, %s, %s, %s) %s / %s (continue)", is_active_cb, info, f, a, kw, can_continue, e)
    8282                time.sleep(wait/1000.0)     #wait is in milliseconds, sleep takes seconds
    8383                if wait<continue_wait:
    8484                    wait += 1
    8585                continue
    86             log("untilConcludes(%s, %s, %s, %s) %s / %s (raised)", is_active_cb, f, a, kw, ABORT.get(code, code), e)
     86            log("untilConcludes(%s, %s, %s, %s, %s) %s / %s (raised)", is_active_cb, info, f, a, kw, ABORT.get(code, code), e)
    8787            raise
    8888
    8989
     
    112112        return untilConcludes(self.is_active, *args)
    113113
    114114    def _write(self, *args):
    115         w = self.untilConcludes(*args)
     115        w = self.untilConcludes("write", *args)
    116116        self.output_bytecount += w
    117117        return w
    118118
    119119    def _read(self, *args):
    120         r = self.untilConcludes(*args)
     120        r = self.untilConcludes("read", *args)
    121121        self.input_bytecount += len(r or "")
    122122        return r
    123123
  • xpra/server/proxy.py

     
    5656
    5757    def _copy_loop(self, log_name, from_conn, to_conn):
    5858        #log("XpraProxy._copy_loop(%s, %s, %s)", log_name, from_conn, to_conn)
     59        readname = "%s-read" % log_name
     60        writename = "%s-write" % log_name
    5961        try:
    6062            while not self._closed:
    6163                log("%s: waiting for data", log_name)
    62                 buf = untilConcludes(self.is_active, from_conn.read, 65536)
     64                buf = untilConcludes(self.is_active, readname, from_conn.read, 65536)
    6365                if not buf:
    6466                    log("%s: connection lost", log_name)
    6567                    return
     
    6870                    log("%s:           %s", log_name, repr_ellipsized(binascii.hexlify(buf)))
    6971                while buf and not self._closed:
    7072                    log("%s: writing %s bytes", log_name, len(buf))
    71                     written = untilConcludes(self.is_active, to_conn.write, buf)
     73                    written = untilConcludes(self.is_active, writename, to_conn.write, buf)
    7274                    buf = buf[written:]
    7375                    log("%s: written %s bytes", log_name, written)
    7476        except Exception as e: