Commit 6e1bbc65 authored by Denis Bilenko's avatar Denis Bilenko

core.buffer: replace raising RuntimeError with logging to stderr and returning empty string

parent 6daae796
......@@ -55,11 +55,18 @@ cdef class buffer:
return ''
cdef char* data = <char*>evbuffer_pullup(self.__obj, size)
if not data:
raise RuntimeError('evbuffer_pullup(%x, %s) returned NULL' % (self._obj, size))
try:
sys.stderr.write('evbuffer_pullup(%x, %s) returned NULL\n' % (self._obj, size))
except:
traceback.print_exc()
return ''
cdef object result = PyString_FromStringAndSize(data, size)
cdef res = EVBUFFER_DRAIN(self.__obj, size)
cdef int res = EVBUFFER_DRAIN(self.__obj, size)
if res:
raise RuntimeError('evbuffer_drain(%x, %s) returned %s' % (self._obj, size, res))
try:
sys.stderr.write('evbuffer_drain(%x, %s) returned %s\n' % (self._obj, size, res))
except:
traceback.print_exc()
return result
def readline(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment