xpra icon
Bug tracker and wiki

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


Ticket #2587: peekable.patch

File peekable.patch, 1.6 KB (added by Antoine Martin, 14 months ago)

make all sockets peekable

  • xpra/net/socket_util.py

     
    161161        peername = address
    162162    sock.settimeout(timeout)
    163163    sockname = sock.getsockname()
     164    from xpra.net.bytestreams import PeekableSocketConnection
    164165    from xpra.net.bytestreams import SocketConnection
    165     conn = SocketConnection(sock, sockname, address, peername, socktype, None, socket_options)
     166    sc = PeekableSocketConnection
     167    #sc = SocketConnection
     168    conn = sc(sock, sockname, address, peername, socktype, None, socket_options)
     169    #conn.enable_peek()
    166170    log("accept_connection(%s, %s, %s)=%s", listener, socktype, timeout, conn)
    167171    return conn
    168172
     
    172176    peek_data = b""
    173177    start = monotonic_time()
    174178    elapsed = 0
     179    from xpra.net.bytestreams import set_socket_timeout
     180    set_socket_timeout(conn, timeout/1000.0/2.0)
    175181    while elapsed<=timeout:
    176182        try:
    177183            peek_data = conn.peek(size)
  • xpra/server/server_core.py

     
    10201020
    10211021        sockname = sock.getsockname()
    10221022        target = peername or sockname
    1023         sock.settimeout(self._socket_timeout)
     1023        #sock.settimeout(self._socket_timeout)
    10241024
    10251025        netlog("handle_new_connection%s sockname=%s, target=%s",
    10261026               (conn, socket_info, socket_options), sockname, target)