diff --git a/examples/bench/echoserver.py b/examples/bench/echoserver.py index 4a982dfa..66c020da 100644 --- a/examples/bench/echoserver.py +++ b/examples/bench/echoserver.py @@ -77,6 +77,8 @@ def data_received(self, data): class EchoBufferedProtocol(asyncio.BufferedProtocol): def connection_made(self, transport): self.transport = transport + # Here the buffer is intended to be copied, so that the outgoing buffer + # won't be wrongly updated by next read self.buffer = bytearray(256 * 1024) def connection_lost(self, exc): diff --git a/uvloop/sslproto.pyx b/uvloop/sslproto.pyx index 21c8ea18..fb3daff6 100644 --- a/uvloop/sslproto.pyx +++ b/uvloop/sslproto.pyx @@ -205,10 +205,10 @@ cdef class SSLProtocol: self._ssl_buffer, self._ssl_buffer_len, PyBUF_WRITE) def __dealloc__(self): + self._ssl_buffer_view = None PyMem_RawFree(self._ssl_buffer) - self._ssl_buffer_len = 0 self._ssl_buffer = NULL - self._ssl_buffer_view = None + self._ssl_buffer_len = 0 def __init__(self, loop, app_protocol, sslcontext, waiter, server_side=False, server_hostname=None,