From f782159bfafabb7486803e78577fc305d272981b Mon Sep 17 00:00:00 2001 From: Momtchil Momtchev Date: Mon, 21 Jun 2021 10:11:45 +0200 Subject: [PATCH] adopt the review changes --- src/stream_wrap.cc | 12 ++++++------ src/stream_wrap.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 8c89121b360c6b..9c5173b79b7a64 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -118,7 +118,7 @@ LibuvStreamWrap::LibuvStreamWrap(Environment* env, provider), StreamBase(env), stream_(stream), - recvQSize(STREAM_WRAP_RECVQ_INITIAL) { + recvq_size(STREAM_WRAP_RECVQ_INITIAL) { StreamBase::AttachToObject(object); } @@ -210,7 +210,7 @@ void LibuvStreamWrap::OnUvAlloc(size_t suggested_size, uv_buf_t* buf) { HandleScope scope(env()->isolate()); Context::Scope context_scope(env()->context()); - *buf = EmitAlloc(recvQSize); + *buf = EmitAlloc(recvq_size); } template @@ -254,10 +254,10 @@ void LibuvStreamWrap::OnUvRead(ssize_t nread, const uv_buf_t* buf) { if (nread > 0) { // Adjust the dynamic receive buffer - if (nread == recvQSize && recvQSize < STREAM_WRAP_RECVQ_MAX) { - recvQSize <<= 1; - } else if (nread < recvQSize / 4 && recvQSize > STREAM_WRAP_RECVQ_MIN) { - recvQSize >>= 1; + if (nread == recvq_size && recvq_size < STREAM_WRAP_RECVQ_MAX) { + recvq_size *= 2; + } else if (nread < recvq_size / 4 && recvq_size > STREAM_WRAP_RECVQ_MIN) { + recvq_size /= 2; } MaybeLocal pending_obj; diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 5163ac10c2719b..13f6ebf050ed1d 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -115,7 +115,7 @@ class LibuvStreamWrap : public HandleWrap, public StreamBase { static void AfterUvShutdown(uv_shutdown_t* req, int status); uv_stream_t* const stream_; - ssize_t recvQSize; + ssize_t recvq_size; #ifdef _WIN32 // We don't always have an FD that we could look up on the stream_