examples: Check return value of evbuffer_drain

This commit is contained in:
Tatsuhiro Tsujikawa 2014-06-18 13:06:05 +09:00
parent 4fdc274a42
commit 85a43cfa66
2 changed files with 9 additions and 2 deletions

View File

@ -425,7 +425,11 @@ static void readcb(struct bufferevent *bev, void *ptr)
delete_http2_session_data(session_data); delete_http2_session_data(session_data);
return; return;
} }
evbuffer_drain(input, readlen); if(evbuffer_drain(input, readlen) != 0) {
warnx("Fatal error: evbuffer_drain failed");
delete_http2_session_data(session_data);
return;
}
if(session_send(session_data) != 0) { if(session_send(session_data) != 0) {
delete_http2_session_data(session_data); delete_http2_session_data(session_data);
return; return;

View File

@ -250,7 +250,10 @@ static int session_recv(http2_session_data *session_data)
warnx("Fatal error: %s", nghttp2_strerror((int)readlen)); warnx("Fatal error: %s", nghttp2_strerror((int)readlen));
return -1; return -1;
} }
evbuffer_drain(input, readlen); if(evbuffer_drain(input, readlen) != 0) {
warnx("Fatal error: evbuffer_drain failed");
return -1;
}
if(session_send(session_data) != 0) { if(session_send(session_data) != 0) {
return -1; return -1;
} }