python: don't ignore decode exception from cnv2pynv

This commit is contained in:
Tatsuhiro Tsujikawa 2012-08-24 21:50:44 +09:00
parent 45c07bec4d
commit 27989fe121
1 changed files with 30 additions and 30 deletions

View File

@ -65,7 +65,7 @@ cdef class SynStreamFrame(CtrlFrame):
cdef uint8_t slot cdef uint8_t slot
cdef object nv cdef object nv
cdef void fill(self, cspdylay.spdylay_syn_stream *frame): cdef fill(self, cspdylay.spdylay_syn_stream *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.stream_id = frame.stream_id self.stream_id = frame.stream_id
@ -94,7 +94,7 @@ cdef class SynReplyFrame(CtrlFrame):
cdef int32_t stream_id cdef int32_t stream_id
cdef object nv cdef object nv
cdef void fill(self, cspdylay.spdylay_syn_reply *frame): cdef fill(self, cspdylay.spdylay_syn_reply *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.stream_id = frame.stream_id self.stream_id = frame.stream_id
@ -111,7 +111,7 @@ cdef class HeadersFrame(CtrlFrame):
cdef int32_t stream_id cdef int32_t stream_id
cdef object nv cdef object nv
cdef void fill(self, cspdylay.spdylay_headers *frame): cdef fill(self, cspdylay.spdylay_headers *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.stream_id = frame.stream_id self.stream_id = frame.stream_id
@ -129,7 +129,7 @@ cdef class RstStreamFrame(CtrlFrame):
cdef int32_t stream_id cdef int32_t stream_id
cdef uint32_t status_code cdef uint32_t status_code
cdef void fill(self, cspdylay.spdylay_rst_stream *frame): cdef fill(self, cspdylay.spdylay_rst_stream *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.stream_id = frame.stream_id self.stream_id = frame.stream_id
@ -146,7 +146,7 @@ cdef class RstStreamFrame(CtrlFrame):
cdef class SettingsFrame(CtrlFrame): cdef class SettingsFrame(CtrlFrame):
cdef object iv cdef object iv
cdef void fill(self, cspdylay.spdylay_settings *frame): cdef fill(self, cspdylay.spdylay_settings *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.iv = csettings2pysettings(frame.niv, frame.iv) self.iv = csettings2pysettings(frame.niv, frame.iv)
@ -159,7 +159,7 @@ cdef class SettingsFrame(CtrlFrame):
cdef class PingFrame(CtrlFrame): cdef class PingFrame(CtrlFrame):
cdef uint32_t unique_id cdef uint32_t unique_id
cdef void fill(self, cspdylay.spdylay_ping *frame): cdef fill(self, cspdylay.spdylay_ping *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.unique_id = frame.unique_id self.unique_id = frame.unique_id
@ -172,7 +172,7 @@ cdef class GoawayFrame(CtrlFrame):
cdef int32_t last_good_stream_id cdef int32_t last_good_stream_id
cdef uint32_t status_code cdef uint32_t status_code
cdef void fill(self, cspdylay.spdylay_goaway *frame): cdef fill(self, cspdylay.spdylay_goaway *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.last_good_stream_id = frame.last_good_stream_id self.last_good_stream_id = frame.last_good_stream_id
@ -190,7 +190,7 @@ cdef class WindowUpdateFrame(CtrlFrame):
cdef int32_t stream_id cdef int32_t stream_id
cdef int32_t delta_window_size cdef int32_t delta_window_size
cdef void fill(self, cspdylay.spdylay_window_update *frame): cdef fill(self, cspdylay.spdylay_window_update *frame):
self.fillhd(&frame.hd) self.fillhd(&frame.hd)
self.stream_id = frame.stream_id self.stream_id = frame.stream_id
@ -204,7 +204,7 @@ cdef class WindowUpdateFrame(CtrlFrame):
def __get__(self): def __get__(self):
return self.delta_window_size return self.delta_window_size
cdef object cnv2pynv(char **nv): cdef cnv2pynv(char **nv):
''' Convert C-style name/value pairs ``nv`` to Python style ''' Convert C-style name/value pairs ``nv`` to Python style
pairs. We assume that strings in nv is UTF-8 encoded as per SPDY pairs. We assume that strings in nv is UTF-8 encoded as per SPDY
spec. In Python pairs, we use unicode string.''' spec. In Python pairs, we use unicode string.'''
@ -322,9 +322,9 @@ cdef void _call_frame_callback(Session pysession,
object callback): object callback):
if not callback: if not callback:
return return
try:
pyframe = cframe2pyframe(frame_type, frame) pyframe = cframe2pyframe(frame_type, frame)
if pyframe: if pyframe:
try:
callback(pysession, pyframe) callback(pysession, pyframe)
except Exception as e: except Exception as e:
pysession.error = e pysession.error = e
@ -348,9 +348,9 @@ cdef void on_invalid_ctrl_recv_callback(cspdylay.spdylay_session *session,
if not pysession.on_invalid_ctrl_recv_cb: if not pysession.on_invalid_ctrl_recv_cb:
return return
try:
pyframe = cframe2pyframe(frame_type, frame) pyframe = cframe2pyframe(frame_type, frame)
if pyframe: if pyframe:
try:
pysession.on_invalid_ctrl_recv_cb(pysession, pyframe, status_code) pysession.on_invalid_ctrl_recv_cb(pysession, pyframe, status_code)
except Exception as e: except Exception as e:
pysession.error = e pysession.error = e
@ -382,9 +382,9 @@ cdef void on_ctrl_not_send_callback(cspdylay.spdylay_session *session,
if not pysession.on_ctrl_not_send_cb: if not pysession.on_ctrl_not_send_cb:
return return
try:
pyframe = cframe2pyframe(frame_type, frame) pyframe = cframe2pyframe(frame_type, frame)
if pyframe: if pyframe:
try:
pysession.on_ctrl_not_send_cb(pysession, pyframe, error_code) pysession.on_ctrl_not_send_cb(pysession, pyframe, error_code)
except Exception as e: except Exception as e:
pysession.error = e pysession.error = e