Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
http2: remove unnecessary GetStream function
Signed-off-by: James M Snell <jasnell@gmail.com>
  • Loading branch information
jasnell committed Apr 16, 2020
commit 52fcf89319168b41e4f8f58290cb28cdff62075d
15 changes: 2 additions & 13 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,6 @@ namespace {

const char zero_bytes_256[256] = {};

Http2Stream* GetStream(Http2Session* session,
int32_t id,
nghttp2_data_source* source) {
Http2Stream* stream = static_cast<Http2Stream*>(source->ptr);
if (stream == nullptr)
stream = session->FindStream(id);
CHECK_NOT_NULL(stream);
CHECK_EQ(id, stream->id());
return stream;
}

} // anonymous namespace

// These configure the callbacks required by nghttp2 itself. There are
Expand Down Expand Up @@ -1662,7 +1651,7 @@ int Http2Session::OnSendData(
nghttp2_data_source* source,
void* user_data) {
Http2Session* session = static_cast<Http2Session*>(user_data);
Http2Stream* stream = GetStream(session, frame->hd.stream_id, source);
Http2Stream* stream = session->FindStream(frame->hd.stream_id);

// Send the frame header + a byte that indicates padding length.
session->CopyDataIntoOutgoing(framehd, 9);
Expand Down Expand Up @@ -2261,7 +2250,7 @@ ssize_t Http2Stream::Provider::Stream::OnRead(nghttp2_session* handle,
void* user_data) {
Http2Session* session = static_cast<Http2Session*>(user_data);
Debug(session, "reading outbound data for stream %d", id);
Http2Stream* stream = GetStream(session, id, source);
Http2Stream* stream = session->FindStream(id);
if (stream->statistics_.first_byte_sent == 0)
stream->statistics_.first_byte_sent = uv_hrtime();
CHECK_EQ(id, stream->id());
Expand Down