Skip to content

Commit a08f0c7

Browse files
committed
CRF: dealloc in the reverse order as init, and added comment
1 parent 7aa193b commit a08f0c7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/bench/echoserver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def data_received(self, data):
7777
class EchoBufferedProtocol(asyncio.BufferedProtocol):
7878
def connection_made(self, transport):
7979
self.transport = transport
80+
# Here the buffer is intended to be copied, so that the outgoing buffer
81+
# won't be wrongly updated by next read
8082
self.buffer = bytearray(256 * 1024)
8183

8284
def connection_lost(self, exc):

uvloop/sslproto.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ cdef class SSLProtocol:
205205
self._ssl_buffer, self._ssl_buffer_len, PyBUF_WRITE)
206206

207207
def __dealloc__(self):
208+
self._ssl_buffer_view = None
208209
PyMem_RawFree(self._ssl_buffer)
209-
self._ssl_buffer_len = 0
210210
self._ssl_buffer = NULL
211-
self._ssl_buffer_view = None
211+
self._ssl_buffer_len = 0
212212

213213
def __init__(self, loop, app_protocol, sslcontext, waiter,
214214
server_side=False, server_hostname=None,

0 commit comments

Comments
 (0)