src: Check return value from nghttp2_session_get_stream_user_data
This commit is contained in:
parent
69a4f3bf42
commit
44b4cda200
|
@ -119,7 +119,7 @@ ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
|
||||||
auto config = client->worker->config;
|
auto config = client->worker->config;
|
||||||
auto req_stat = static_cast<RequestStat *>(
|
auto req_stat = static_cast<RequestStat *>(
|
||||||
nghttp2_session_get_stream_user_data(session, stream_id));
|
nghttp2_session_get_stream_user_data(session, stream_id));
|
||||||
|
assert(req_stat);
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
while ((nread = pread(config->data_fd, buf, length, req_stat->data_offset)) ==
|
while ((nread = pread(config->data_fd, buf, length, req_stat->data_offset)) ==
|
||||||
-1 &&
|
-1 &&
|
||||||
|
|
|
@ -500,6 +500,10 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame,
|
||||||
auto downstream = static_cast<Downstream *>(
|
auto downstream = static_cast<Downstream *>(
|
||||||
nghttp2_session_get_stream_user_data(session, stream_id));
|
nghttp2_session_get_stream_user_data(session, stream_id));
|
||||||
|
|
||||||
|
if (!downstream) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// For tunneling, issue RST_STREAM to finish the stream.
|
// For tunneling, issue RST_STREAM to finish the stream.
|
||||||
if (downstream->get_upgraded() ||
|
if (downstream->get_upgraded() ||
|
||||||
nghttp2_session_get_stream_remote_close(session, stream_id) == 0) {
|
nghttp2_session_get_stream_remote_close(session, stream_id) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue