nghttpd, tiny-nghttpd: No need to check existence of stream
The stream existence is guaranteed by library as of
cc03a12b75
.
This commit is contained in:
parent
cc03a12b75
commit
7522d50d1a
|
@ -660,17 +660,11 @@ static void stream_error(connection *conn, int32_t stream_id,
|
||||||
|
|
||||||
static int send_data_callback(nghttp2_session *session _U_,
|
static int send_data_callback(nghttp2_session *session _U_,
|
||||||
nghttp2_frame *frame, const uint8_t *framehd,
|
nghttp2_frame *frame, const uint8_t *framehd,
|
||||||
size_t length, nghttp2_data_source *source _U_,
|
size_t length, nghttp2_data_source *source,
|
||||||
void *user_data) {
|
void *user_data) {
|
||||||
connection *conn = user_data;
|
connection *conn = user_data;
|
||||||
uint8_t *p = conn->buf.last;
|
uint8_t *p = conn->buf.last;
|
||||||
stream *strm;
|
stream *strm = source->ptr;
|
||||||
|
|
||||||
strm = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
|
|
||||||
|
|
||||||
if (!strm) {
|
|
||||||
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We never use padding in this program */
|
/* We never use padding in this program */
|
||||||
assert(frame->data.padlen == 0);
|
assert(frame->data.padlen == 0);
|
||||||
|
|
|
@ -1218,12 +1218,6 @@ int send_data_callback(nghttp2_session *session, nghttp2_frame *frame,
|
||||||
const uint8_t *framehd, size_t length,
|
const uint8_t *framehd, size_t length,
|
||||||
nghttp2_data_source *source, void *user_data) {
|
nghttp2_data_source *source, void *user_data) {
|
||||||
auto hd = static_cast<Http2Handler *>(user_data);
|
auto hd = static_cast<Http2Handler *>(user_data);
|
||||||
auto stream = hd->get_stream(frame->hd.stream_id);
|
|
||||||
|
|
||||||
if (!stream) {
|
|
||||||
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto wb = hd->get_wb();
|
auto wb = hd->get_wb();
|
||||||
auto padlen = frame->data.padlen;
|
auto padlen = frame->data.padlen;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue