diff options
author | elantsev <elantsev@yandex-team.ru> | 2022-02-10 16:49:47 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:47 +0300 |
commit | 095c2e55a230f89487c2f2caace05e108742d72c (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp | |
parent | afa1b6e6f8b6ee9f8df080d41bcb19b95c25c261 (diff) | |
download | ydb-095c2e55a230f89487c2f2caace05e108742d72c.tar.gz |
Restoring authorship annotation for <elantsev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/coroutine/engine/impl.h | 8 | ||||
-rw-r--r-- | library/cpp/coroutine/engine/poller.cpp | 10 | ||||
-rw-r--r-- | library/cpp/coroutine/listener/listen.cpp | 18 | ||||
-rw-r--r-- | library/cpp/coroutine/listener/listen.h | 28 | ||||
-rw-r--r-- | library/cpp/http/io/stream.cpp | 4 | ||||
-rw-r--r-- | library/cpp/http/io/stream_ut.cpp | 80 |
6 files changed, 74 insertions, 74 deletions
diff --git a/library/cpp/coroutine/engine/impl.h b/library/cpp/coroutine/engine/impl.h index 715454d695..283a96ecf1 100644 --- a/library/cpp/coroutine/engine/impl.h +++ b/library/cpp/coroutine/engine/impl.h @@ -92,9 +92,9 @@ public: } bool Scheduled() const noexcept { - return Scheduled_; - } - + return Scheduled_; + } + bool Join(TCont* c, TInstant deadLine = TInstant::Max()) noexcept; void ReSchedule() noexcept; @@ -116,7 +116,7 @@ private: NCoro::TTrampoline Trampoline_; - TIntrusiveList<TJoinWait> Waiters_; + TIntrusiveList<TJoinWait> Waiters_; bool Cancelled_ = false; bool Scheduled_ = false; }; diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp index 4a8a33e4af..61164fa56b 100644 --- a/library/cpp/coroutine/engine/poller.cpp +++ b/library/cpp/coroutine/engine/poller.cpp @@ -82,9 +82,9 @@ namespace { } void Reserve(size_t size) { - E_.Reserve(size); - } - + E_.Reserve(size); + } + void Wait(TEvents& events, TInstant deadLine) { const size_t ret = P_.WaitD(~E_, +E_, deadLine); @@ -220,8 +220,8 @@ namespace { for (TFds::TConstIterator it = S_.Begin(); it != S_.End(); ++it) { t.Set(*it); } - - t.Reserve(Size()); + + t.Reserve(Size()); } void Set(const TChange& c) { diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp index e7b56a3363..3d4e711d1d 100644 --- a/library/cpp/coroutine/listener/listen.cpp +++ b/library/cpp/coroutine/listener/listen.cpp @@ -65,18 +65,18 @@ private: FixIPv6ListenSocket(ListenSocket_); CheckedSetSockOpt(ListenSocket_, SOL_SOCKET, SO_REUSEADDR, 1, "reuse addr"); - - const TOptions& opts = Parent_->Opts_; - if (opts.SendBufSize) { - SetOutputBuffer(ListenSocket_, opts.SendBufSize); - } - if (opts.RecvBufSize) { - SetInputBuffer(ListenSocket_, opts.RecvBufSize); - } + + const TOptions& opts = Parent_->Opts_; + if (opts.SendBufSize) { + SetOutputBuffer(ListenSocket_, opts.SendBufSize); + } + if (opts.RecvBufSize) { + SetInputBuffer(ListenSocket_, opts.RecvBufSize); + } if (opts.ReusePort) { SetReusePort(ListenSocket_, opts.ReusePort); } - + SetNonBlock(ListenSocket_); if (bind(ListenSocket_, Addr_->Addr(), Addr_->Len()) < 0) { diff --git a/library/cpp/coroutine/listener/listen.h b/library/cpp/coroutine/listener/listen.h index 1c96e9ef4e..3a89cd3ecc 100644 --- a/library/cpp/coroutine/listener/listen.h +++ b/library/cpp/coroutine/listener/listen.h @@ -17,8 +17,8 @@ public: struct TOptions { inline TOptions() noexcept : ListenQueue(Max<size_t>()) - , SendBufSize(0) - , RecvBufSize(0) + , SendBufSize(0) + , RecvBufSize(0) , EnableDeferAccept(false) , ReusePort(false) { @@ -37,17 +37,17 @@ public: } inline TOptions& SetSendBufSize(unsigned size) noexcept { - SendBufSize = size; - - return *this; - } - + SendBufSize = size; + + return *this; + } + inline TOptions& SetRecvBufSize(unsigned size) noexcept { - RecvBufSize = size; - - return *this; - } - + RecvBufSize = size; + + return *this; + } + inline TOptions& SetReusePort(bool reusePort) noexcept { ReusePort = reusePort; @@ -55,8 +55,8 @@ public: } size_t ListenQueue; - unsigned SendBufSize; - unsigned RecvBufSize; + unsigned SendBufSize; + unsigned RecvBufSize; bool EnableDeferAccept; bool ReusePort; }; diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 531a404457..6689be684f 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -649,8 +649,8 @@ private: return true; } return false; - } - + } + inline bool IsHttpResponse() const noexcept { return IsResponse(FirstLine_); } diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 638f1f5df9..1ea35df675 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -613,57 +613,57 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { Y_UNIT_TEST(TestHttpInputHeadRequest) { class THeadOnlyInput: public IInputStream { - public: - THeadOnlyInput() = default; - - private: - size_t DoRead(void* buf, size_t len) override { - if (Eof_) { - ythrow yexception() << "should not read after EOF"; - } - + public: + THeadOnlyInput() = default; + + private: + size_t DoRead(void* buf, size_t len) override { + if (Eof_) { + ythrow yexception() << "should not read after EOF"; + } + const size_t toWrite = Min(len, Data_.size() - Pos_); - if (toWrite == 0) { - Eof_ = true; - return 0; - } - - memcpy(buf, Data_.data() + Pos_, toWrite); - Pos_ += toWrite; - return toWrite; - } - - private: + if (toWrite == 0) { + Eof_ = true; + return 0; + } + + memcpy(buf, Data_.data() + Pos_, toWrite); + Pos_ += toWrite; + return toWrite; + } + + private: TString Data_{TStringBuf("HEAD / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n")}; size_t Pos_{0}; bool Eof_{false}; - }; - THeadOnlyInput input; - THttpInput httpInput(&input); - - UNIT_ASSERT(!httpInput.HasContent()); - UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), ""); - } - + }; + THeadOnlyInput input; + THttpInput httpInput(&input); + + UNIT_ASSERT(!httpInput.HasContent()); + UNIT_ASSERT_VALUES_EQUAL(httpInput.ReadAll(), ""); + } + Y_UNIT_TEST(TestHttpOutputResponseToHeadRequestNoZeroChunk) { - TStringStream request; + TStringStream request; request << "HEAD / HTTP/1.1\r\n" "Host: yandex.ru\r\n" "Connection: Keep-Alive\r\n" "\r\n"; - - TStringInput input(request.Str()); - THttpInput httpInput(&input); - - TStringStream outBuf; - THttpOutput out(&outBuf, &httpInput); - out.EnableKeepAlive(true); - out << "HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n"; - out << ""; - out.Finish(); + + TStringInput input(request.Str()); + THttpInput httpInput(&input); + + TStringStream outBuf; + THttpOutput out(&outBuf, &httpInput); + out.EnableKeepAlive(true); + out << "HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n"; + out << ""; + out.Finish(); TString result = outBuf.Str(); UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n"))); - } + } Y_UNIT_TEST(TestHttpOutputDisableCompressionHeader) { TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n"); |