mirror of https://github.com/MagicStack/uvloop.git
Some minor tweaks for debug logging
This commit is contained in:
parent
cce6f3bb77
commit
20fa09979f
|
@ -32,7 +32,8 @@ async def echo_client(loop, client):
|
|||
if not data:
|
||||
break
|
||||
await loop.sock_sendall(client, data)
|
||||
print('Connection closed')
|
||||
if PRINT:
|
||||
print('Connection closed')
|
||||
|
||||
|
||||
async def echo_client_streams(reader, writer):
|
||||
|
@ -47,6 +48,7 @@ async def echo_client_streams(reader, writer):
|
|||
await writer.drain()
|
||||
if PRINT:
|
||||
print('Connection closed')
|
||||
writer.close()
|
||||
|
||||
|
||||
async def print_debug(loop):
|
||||
|
|
|
@ -24,15 +24,21 @@ cdef class Handle:
|
|||
if self.cancelled == 1 or self.done == 1:
|
||||
return
|
||||
|
||||
callback = self.callback
|
||||
args = self.args
|
||||
|
||||
self.callback = None
|
||||
self.args = None
|
||||
|
||||
self.done = 1
|
||||
try:
|
||||
if self.args is not None:
|
||||
self.callback(*self.args)
|
||||
if args is not None:
|
||||
callback(*args)
|
||||
else:
|
||||
self.callback()
|
||||
callback()
|
||||
except Exception as ex:
|
||||
self.loop.call_exception_handler({
|
||||
'message': 'Exception in callback {}'.format(self.callback),
|
||||
'message': 'Exception in callback {}'.format(callback),
|
||||
'exception': ex
|
||||
})
|
||||
|
||||
|
|
|
@ -38,13 +38,12 @@ cdef class __StreamWriteContext:
|
|||
return
|
||||
|
||||
self.closed = 1
|
||||
|
||||
PyBuffer_Release(&self.py_buf)
|
||||
|
||||
self.callback = None
|
||||
PyBuffer_Release(&self.py_buf) # void
|
||||
self.req.data = NULL
|
||||
Py_DECREF(self)
|
||||
|
||||
IF DEBUG:
|
||||
self.stream._loop._debug_stream_write_ctx_cnt -= 1
|
||||
IF not DEBUG:
|
||||
self.stream = None
|
||||
|
||||
IF DEBUG:
|
||||
def __dealloc__(self):
|
||||
|
@ -52,6 +51,11 @@ cdef class __StreamWriteContext:
|
|||
raise RuntimeError(
|
||||
'open __StreamWriteContext is being deallocated')
|
||||
|
||||
IF DEBUG:
|
||||
self.stream._loop._debug_stream_write_ctx_cnt -= 1
|
||||
|
||||
self.stream = None
|
||||
|
||||
|
||||
@cython.internal
|
||||
@cython.no_gc_clear
|
||||
|
|
Loading…
Reference in New Issue