Skip to content

Commit

Permalink
CRF: dealloc in the reverse order as init, and added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Aug 21, 2018
1 parent 7aa193b commit a08f0c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions examples/bench/echoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions uvloop/sslproto.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a08f0c7

Please sign in to comment.