1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-12-22 23:58:53 -05:00

Added spdylay_is_fatal

This commit is contained in:
Tatsuhiro Tsujikawa 2012-03-08 00:40:17 +09:00
parent 0a7c510147
commit fcde841cab

View File

@ -51,6 +51,14 @@ static int spdylay_is_non_fatal(int error)
return error < 0 && error > SPDYLAY_ERR_FATAL; return error < 0 && error > SPDYLAY_ERR_FATAL;
} }
/*
* Returns non-zero if |error| is fatal error.
*/
static int spdylay_is_fatal(int error)
{
return error < SPDYLAY_ERR_FATAL;
}
int spdylay_session_is_my_stream_id(spdylay_session *session, int spdylay_session_is_my_stream_id(spdylay_session *session,
int32_t stream_id) int32_t stream_id)
{ {
@ -1156,7 +1164,7 @@ int spdylay_session_send(spdylay_session *session)
} }
spdylay_outbound_item_free(item); spdylay_outbound_item_free(item);
free(item); free(item);
if(framebuflen < SPDYLAY_ERR_FATAL) { if(spdylay_is_fatal(framebuflen)) {
return framebuflen; return framebuflen;
} else { } else {
continue; continue;
@ -1794,7 +1802,7 @@ static int spdylay_session_process_ctrl_frame(spdylay_session *session)
} }
break; break;
} }
if(r < SPDYLAY_ERR_FATAL) { if(spdylay_is_fatal(r)) {
return r; return r;
} else { } else {
return 0; return 0;
@ -1866,7 +1874,7 @@ static int spdylay_session_process_data_frame(spdylay_session *session)
length = spdylay_get_uint32(&session->iframe.headbuf[4]) & length = spdylay_get_uint32(&session->iframe.headbuf[4]) &
SPDYLAY_LENGTH_MASK; SPDYLAY_LENGTH_MASK;
r = spdylay_session_on_data_received(session, flags, length, stream_id); r = spdylay_session_on_data_received(session, flags, length, stream_id);
if(r < SPDYLAY_ERR_FATAL) { if(spdylay_is_fatal(r)) {
return r; return r;
} else { } else {
return 0; return 0;