This commit is contained in:
Tatsuhiro Tsujikawa 2015-12-10 23:18:02 +09:00
parent ba671a8473
commit 0c70ff5658
1 changed files with 36 additions and 38 deletions

View File

@ -2556,6 +2556,8 @@ static int session_after_frame_sent2(nghttp2_session *session) {
nghttp2_bufs *framebufs = &aob->framebufs; nghttp2_bufs *framebufs = &aob->framebufs;
nghttp2_frame *frame; nghttp2_frame *frame;
nghttp2_mem *mem; nghttp2_mem *mem;
nghttp2_stream *stream;
nghttp2_data_aux_data *aux_data;
mem = &session->mem; mem = &session->mem;
frame = &item->frame; frame = &item->frame;
@ -2578,50 +2580,46 @@ static int session_after_frame_sent2(nghttp2_session *session) {
active_outbound_item_reset(&session->aob, mem); active_outbound_item_reset(&session->aob, mem);
return 0; return 0;
} else { }
nghttp2_stream *stream;
nghttp2_data_aux_data *aux_data;
aux_data = &item->aux_data.data; /* DATA frame */
/* On EOF, we have already detached data. Please note that aux_data = &item->aux_data.data;
application may issue nghttp2_submit_data() in
on_frame_send_callback (call from session_after_frame_sent1),
which attach data to stream. We don't want to detach it. */
if (aux_data->eof) {
active_outbound_item_reset(aob, mem);
return 0; /* On EOF, we have already detached data. Please note that
} application may issue nghttp2_submit_data() in
on_frame_send_callback (call from session_after_frame_sent1),
/* Reset no_copy here because next write may not use this. */ which attach data to stream. We don't want to detach it. */
aux_data->no_copy = 0; if (aux_data->eof) {
active_outbound_item_reset(aob, mem);
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
/* If session is closed or RST_STREAM was queued, we won't send
further data. */
if (nghttp2_session_predicate_data_send(session, stream) != 0) {
if (stream) {
rv = nghttp2_stream_detach_item(stream);
if (nghttp2_is_fatal(rv)) {
return rv;
}
}
active_outbound_item_reset(aob, mem);
return 0;
}
aob->item = NULL;
active_outbound_item_reset(&session->aob, mem);
return 0; return 0;
} }
/* Unreachable */
assert(0); /* Reset no_copy here because next write may not use this. */
aux_data->no_copy = 0;
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
/* If session is closed or RST_STREAM was queued, we won't send
further data. */
if (nghttp2_session_predicate_data_send(session, stream) != 0) {
if (stream) {
rv = nghttp2_stream_detach_item(stream);
if (nghttp2_is_fatal(rv)) {
return rv;
}
}
active_outbound_item_reset(aob, mem);
return 0;
}
aob->item = NULL;
active_outbound_item_reset(&session->aob, mem);
return 0; return 0;
} }