Skip to content

Commit

Permalink
[Squash] address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Nov 2, 2017
1 parent 125e1b5 commit 1c6ec13
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ int Http2Session::DoWrite(WriteWrap* req_wrap,
return 0;
}

size_t Http2Session::AllocateSend(WriteWrap** req) {
WriteWrap* Http2Session::AllocateSend() {
HandleScope scope(env()->isolate());
auto AfterWrite = [](WriteWrap* req, int status) {
req->Dispose();
Expand All @@ -906,8 +906,8 @@ size_t Http2Session::AllocateSend(WriteWrap** req) {
nghttp2_session_get_remote_settings(
session(),
NGHTTP2_SETTINGS_MAX_FRAME_SIZE);
*req = WriteWrap::New(env(), obj, this, AfterWrite, size);
return size;
// Max frame size + 9 bytes for the header
return WriteWrap::New(env(), obj, this, AfterWrite, size + 9);
}

void Http2Session::Send(WriteWrap* req, char* buf, size_t length) {
Expand Down
2 changes: 1 addition & 1 deletion src/node_http2.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class Http2Session : public AsyncWrap,
const SubmitTrailers& submit_trailers) override;

void Send(WriteWrap* req, char* buf, size_t length) override;
size_t AllocateSend(WriteWrap** req);
WriteWrap* AllocateSend();

int DoWrite(WriteWrap* w, uv_buf_t* bufs, size_t count,
uv_stream_t* send_handle) override;
Expand Down
6 changes: 4 additions & 2 deletions src/node_http2_core-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ inline void Nghttp2Session::SendPendingData() {
// While srcLength is greater than zero
while ((srcLength = nghttp2_session_mem_send(session_, &src)) > 0) {
if (req == nullptr) {
destRemaining = AllocateSend(&req);
req = AllocateSend();
destRemaining = req->self_size();
dest = req->Extra();
}
DEBUG_HTTP2("Nghttp2Session %s: nghttp2 has %d bytes to send\n",
Expand All @@ -523,7 +524,8 @@ inline void Nghttp2Session::SendPendingData() {
destLength = 0;
srcRemaining -= destRemaining;
srcOffset += destRemaining;
destRemaining = AllocateSend(&req);
req = AllocateSend();
destRemaining = req->self_size();
dest = req->Extra();
}

Expand Down
2 changes: 1 addition & 1 deletion src/node_http2_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class Nghttp2Session {

inline void SendPendingData();
virtual void Send(WriteWrap* req, char* buf, size_t length) = 0;
virtual size_t AllocateSend(WriteWrap** req) = 0;
virtual WriteWrap* AllocateSend() = 0;

virtual bool HasGetPaddingCallback() { return false; }

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ test-npm-install: PASS,FLAKY
[$system==solaris] # Also applies to SmartOS

[$system==freebsd]
test-http2-compat-serverrequest-pipe: PASS,FLAKY
test-http2-pipe: PASS,FLAKY

[$system==aix]

0 comments on commit 1c6ec13

Please sign in to comment.