diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/messagebus | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus')
94 files changed, 504 insertions, 504 deletions
diff --git a/library/cpp/messagebus/acceptor.cpp b/library/cpp/messagebus/acceptor.cpp index 64a38619c2..65db22c217 100644 --- a/library/cpp/messagebus/acceptor.cpp +++ b/library/cpp/messagebus/acceptor.cpp @@ -113,8 +113,8 @@ void TAcceptor::SendStatus(TInstant now) { } void TAcceptor::HandleEvent(SOCKET socket, void* cookie) { - Y_UNUSED(socket); - Y_UNUSED(cookie); + Y_UNUSED(socket); + Y_UNUSED(cookie); GetActor()->Schedule(); } diff --git a/library/cpp/messagebus/acceptor_status.cpp b/library/cpp/messagebus/acceptor_status.cpp index 5006ff68ae..ff0e9d978b 100644 --- a/library/cpp/messagebus/acceptor_status.cpp +++ b/library/cpp/messagebus/acceptor_status.cpp @@ -25,8 +25,8 @@ void TAcceptorStatus::ResetIncremental() { } TAcceptorStatus& TAcceptorStatus::operator+=(const TAcceptorStatus& that) { - Y_ASSERT(Summary); - Y_ASSERT(AcceptorId == 0); + Y_ASSERT(Summary); + Y_ASSERT(AcceptorId == 0); AcceptSuccessCount += that.AcceptSuccessCount; LastAcceptSuccessInstant = Max(LastAcceptSuccessInstant, that.LastAcceptSuccessInstant); diff --git a/library/cpp/messagebus/actor/actor_ut.cpp b/library/cpp/messagebus/actor/actor_ut.cpp index b76ab55bfa..6d46c03a05 100644 --- a/library/cpp/messagebus/actor/actor_ut.cpp +++ b/library/cpp/messagebus/actor/actor_ut.cpp @@ -92,8 +92,8 @@ struct TObjectCountChecker { } }; -Y_UNIT_TEST_SUITE(TActor) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TActor) { + Y_UNIT_TEST(Simple) { TObjectCountChecker objectCountChecker; TExecutor executor(4); @@ -105,7 +105,7 @@ Y_UNIT_TEST_SUITE(TActor) { actor->Acted.WaitFor(1u); } - Y_UNIT_TEST(ScheduleAfterStart) { + Y_UNIT_TEST(ScheduleAfterStart) { TObjectCountChecker objectCountChecker; TExecutor executor(4); @@ -147,11 +147,11 @@ Y_UNIT_TEST_SUITE(TActor) { } } - Y_UNIT_TEST(ComplexContention) { + Y_UNIT_TEST(ComplexContention) { ComplexImpl(4, 6); } - Y_UNIT_TEST(ComplexNoContention) { + Y_UNIT_TEST(ComplexNoContention) { ComplexImpl(6, 4); } } diff --git a/library/cpp/messagebus/actor/executor.cpp b/library/cpp/messagebus/actor/executor.cpp index 7a2227a458..925e8e5388 100644 --- a/library/cpp/messagebus/actor/executor.cpp +++ b/library/cpp/messagebus/actor/executor.cpp @@ -178,7 +178,7 @@ void TExecutor::Init() { AtomicSet(ExitWorkers, 0); - Y_VERIFY(Config.WorkerCount > 0); + Y_VERIFY(Config.WorkerCount > 0); for (size_t i = 0; i < Config.WorkerCount; i++) { WorkerThreads.push_back(new TExecutorWorker(this)); @@ -215,7 +215,7 @@ void TExecutor::EnqueueWork(TArrayRef<IWorkItem* const> wis) { return; if (Y_UNLIKELY(AtomicGet(ExitWorkers) != 0)) { - Y_VERIFY(WorkItems.Empty(), "executor %s: cannot add tasks after queue shutdown", Config.Name); + Y_VERIFY(WorkItems.Empty(), "executor %s: cannot add tasks after queue shutdown", Config.Name); } TWhatThreadDoesPushPop pp("executor: EnqueueWork"); @@ -319,7 +319,7 @@ void TExecutor::ProcessWorkQueueHere() { } void TExecutor::RunWorker() { - Y_VERIFY(!ThreadCurrentExecutor, "state check"); + Y_VERIFY(!ThreadCurrentExecutor, "state check"); ThreadCurrentExecutor = this; SetCurrentThreadName("wrkr"); diff --git a/library/cpp/messagebus/actor/ring_buffer.h b/library/cpp/messagebus/actor/ring_buffer.h index ec5706f7c7..0cf401bfda 100644 --- a/library/cpp/messagebus/actor/ring_buffer.h +++ b/library/cpp/messagebus/actor/ring_buffer.h @@ -17,12 +17,12 @@ private: TVector<T> Data; void StateCheck() const { - Y_ASSERT(Capacity == Data.size()); - Y_ASSERT(Capacity == (1u << CapacityPow)); - Y_ASSERT((Capacity & CapacityMask) == 0u); - Y_ASSERT(Capacity - CapacityMask == 1u); - Y_ASSERT(WritePos < Capacity); - Y_ASSERT(ReadPos < Capacity); + Y_ASSERT(Capacity == Data.size()); + Y_ASSERT(Capacity == (1u << CapacityPow)); + Y_ASSERT((Capacity & CapacityMask) == 0u); + Y_ASSERT(Capacity - CapacityMask == 1u); + Y_ASSERT(WritePos < Capacity); + Y_ASSERT(ReadPos < Capacity); } size_t Writable() const { diff --git a/library/cpp/messagebus/actor/ring_buffer_ut.cpp b/library/cpp/messagebus/actor/ring_buffer_ut.cpp index bdb379b3a9..2accea357c 100644 --- a/library/cpp/messagebus/actor/ring_buffer_ut.cpp +++ b/library/cpp/messagebus/actor/ring_buffer_ut.cpp @@ -4,7 +4,7 @@ #include <util/random/random.h> -Y_UNIT_TEST_SUITE(RingBuffer) { +Y_UNIT_TEST_SUITE(RingBuffer) { struct TRingBufferTester { TRingBuffer<unsigned> RingBuffer; @@ -52,7 +52,7 @@ Y_UNIT_TEST_SUITE(RingBuffer) { } } - Y_UNIT_TEST(Random) { + Y_UNIT_TEST(Random) { for (unsigned i = 0; i < 100; ++i) { Iter(); } diff --git a/library/cpp/messagebus/actor/tasks_ut.cpp b/library/cpp/messagebus/actor/tasks_ut.cpp index d80e8451a5..270392330f 100644 --- a/library/cpp/messagebus/actor/tasks_ut.cpp +++ b/library/cpp/messagebus/actor/tasks_ut.cpp @@ -4,8 +4,8 @@ using namespace NActor; -Y_UNIT_TEST_SUITE(TTasks) { - Y_UNIT_TEST(AddTask_FetchTask_Simple) { +Y_UNIT_TEST_SUITE(TTasks) { + Y_UNIT_TEST(AddTask_FetchTask_Simple) { TTasks tasks; UNIT_ASSERT(tasks.AddTask()); @@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(TTasks) { UNIT_ASSERT(tasks.AddTask()); } - Y_UNIT_TEST(AddTask_FetchTask_AddTask) { + Y_UNIT_TEST(AddTask_FetchTask_AddTask) { TTasks tasks; UNIT_ASSERT(tasks.AddTask()); diff --git a/library/cpp/messagebus/actor/temp_tls_vector.h b/library/cpp/messagebus/actor/temp_tls_vector.h index 675d92f5b0..02d7bf8c76 100644 --- a/library/cpp/messagebus/actor/temp_tls_vector.h +++ b/library/cpp/messagebus/actor/temp_tls_vector.h @@ -19,7 +19,7 @@ public: TTempTlsVector() { Vector = FastTlsSingletonWithTag<TVectorType<T, std::allocator<T>>, TTagForTls>(); - Y_ASSERT(Vector->empty()); + Y_ASSERT(Vector->empty()); } ~TTempTlsVector() { diff --git a/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp b/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp index e4b218a7ca..96ddeb0f08 100644 --- a/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp +++ b/library/cpp/messagebus/actor/what_thread_does_guard_ut.cpp @@ -4,8 +4,8 @@ #include <util/system/mutex.h> -Y_UNIT_TEST_SUITE(WhatThreadDoesGuard) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(WhatThreadDoesGuard) { + Y_UNIT_TEST(Simple) { TMutex mutex; TWhatThreadDoesAcquireGuard<TMutex> guard(mutex, "acquiring my mutex"); diff --git a/library/cpp/messagebus/async_result.h b/library/cpp/messagebus/async_result.h index d24dde284a..2c6a42095c 100644 --- a/library/cpp/messagebus/async_result.h +++ b/library/cpp/messagebus/async_result.h @@ -24,7 +24,7 @@ private: public: void SetResult(const T& result) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(!Result, "cannot set result twice"); + Y_VERIFY(!Result, "cannot set result twice"); Result = result; CondVar.BroadCast(); @@ -47,7 +47,7 @@ public: if (!!Result) { onResult(*Result); } else { - Y_ASSERT(!OnResult); + Y_ASSERT(!OnResult); OnResult = std::function<TOnResult>(onResult); } } diff --git a/library/cpp/messagebus/async_result_ut.cpp b/library/cpp/messagebus/async_result_ut.cpp index 2e96492afd..3508b6bd8e 100644 --- a/library/cpp/messagebus/async_result_ut.cpp +++ b/library/cpp/messagebus/async_result_ut.cpp @@ -10,8 +10,8 @@ namespace { } -Y_UNIT_TEST_SUITE(TAsyncResult) { - Y_UNIT_TEST(AndThen_Here) { +Y_UNIT_TEST_SUITE(TAsyncResult) { + Y_UNIT_TEST(AndThen_Here) { TAsyncResult<int> r; int var = 1; @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TAsyncResult) { UNIT_ASSERT_VALUES_EQUAL(17, var); } - Y_UNIT_TEST(AndThen_Later) { + Y_UNIT_TEST(AndThen_Later) { TAsyncResult<int> r; int var = 1; diff --git a/library/cpp/messagebus/cc_semaphore_ut.cpp b/library/cpp/messagebus/cc_semaphore_ut.cpp index 206bb7c96a..0b37c7b990 100644 --- a/library/cpp/messagebus/cc_semaphore_ut.cpp +++ b/library/cpp/messagebus/cc_semaphore_ut.cpp @@ -29,8 +29,8 @@ namespace { }; } -Y_UNIT_TEST_SUITE(TComplexConditionSemaphore) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TComplexConditionSemaphore) { + Y_UNIT_TEST(Simple) { TTestSemaphore sema; UNIT_ASSERT(!sema.TryWait()); sema.Release(); diff --git a/library/cpp/messagebus/config/netaddr.cpp b/library/cpp/messagebus/config/netaddr.cpp index 962ac538e2..a83c7d7bf1 100644 --- a/library/cpp/messagebus/config/netaddr.cpp +++ b/library/cpp/messagebus/config/netaddr.cpp @@ -178,6 +178,6 @@ namespace NBus { } template <> -void Out<NBus::TNetAddr>(IOutputStream& out, const NBus::TNetAddr& addr) { +void Out<NBus::TNetAddr>(IOutputStream& out, const NBus::TNetAddr& addr) { Out<NAddr::IRemoteAddr>(out, addr); } diff --git a/library/cpp/messagebus/config/session_config.cpp b/library/cpp/messagebus/config/session_config.cpp index fbbbb106c9..5dc6327392 100644 --- a/library/cpp/messagebus/config/session_config.cpp +++ b/library/cpp/messagebus/config/session_config.cpp @@ -29,14 +29,14 @@ static int ParseDurationForMessageBus(const char* option) { static int ParseToSForMessageBus(const char* option) { int tos; TStringBuf str(option); - if (str.StartsWith("0x")) { + if (str.StartsWith("0x")) { str = str.Tail(2); - Y_VERIFY(str.length() == 2, "ToS must be a number between 0x00 and 0xFF"); + Y_VERIFY(str.length() == 2, "ToS must be a number between 0x00 and 0xFF"); tos = String2Byte(str.data()); } else { tos = FromString<int>(option); } - Y_VERIFY(tos >= 0 && tos <= 255, "ToS must be between 0x00 and 0xFF"); + Y_VERIFY(tos >= 0 && tos <= 255, "ToS must be between 0x00 and 0xFF"); return tos; } @@ -44,13 +44,13 @@ template <class T> static T ParseWithKmgSuffixT(const char* option) { TStringBuf str(option); T multiplier = 1; - if (str.EndsWith('k')) { + if (str.EndsWith('k')) { multiplier = 1024; str = str.Head(str.size() - 1); - } else if (str.EndsWith('m')) { + } else if (str.EndsWith('m')) { multiplier = 1024 * 1024; str = str.Head(str.size() - 1); - } else if (str.EndsWith('g')) { + } else if (str.EndsWith('g')) { multiplier = 1024 * 1024 * 1024; str = str.Head(str.size() - 1); } diff --git a/library/cpp/messagebus/coreconn_ut.cpp b/library/cpp/messagebus/coreconn_ut.cpp index beb6850f26..64f760cf13 100644 --- a/library/cpp/messagebus/coreconn_ut.cpp +++ b/library/cpp/messagebus/coreconn_ut.cpp @@ -4,22 +4,22 @@ #include <util/generic/yexception.h> -Y_UNIT_TEST_SUITE(TMakeIpVersionTest) { +Y_UNIT_TEST_SUITE(TMakeIpVersionTest) { using namespace NBus; - Y_UNIT_TEST(IpV4Allowed) { + Y_UNIT_TEST(IpV4Allowed) { UNIT_ASSERT_EQUAL(MakeIpVersion(true, false), EIP_VERSION_4); } - Y_UNIT_TEST(IpV6Allowed) { + Y_UNIT_TEST(IpV6Allowed) { UNIT_ASSERT_EQUAL(MakeIpVersion(false, true), EIP_VERSION_6); } - Y_UNIT_TEST(AllAllowed) { + Y_UNIT_TEST(AllAllowed) { UNIT_ASSERT_EQUAL(MakeIpVersion(true, true), EIP_VERSION_ANY); } - Y_UNIT_TEST(NothingAllowed) { + Y_UNIT_TEST(NothingAllowed) { UNIT_ASSERT_EXCEPTION(MakeIpVersion(false, false), yexception); } } diff --git a/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp b/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp index 0c74f9ecc3..dbe325e255 100644 --- a/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp +++ b/library/cpp/messagebus/debug_receiver/debug_receiver_proto.cpp @@ -8,7 +8,7 @@ TDebugReceiverProtocol::TDebugReceiverProtocol() } void TDebugReceiverProtocol::Serialize(const NBus::TBusMessage*, TBuffer&) { - Y_FAIL("it is receiver only"); + Y_FAIL("it is receiver only"); } TAutoPtr<NBus::TBusMessage> TDebugReceiverProtocol::Deserialize(ui16, TArrayRef<const char> payload) { diff --git a/library/cpp/messagebus/duration_histogram.cpp b/library/cpp/messagebus/duration_histogram.cpp index 32a0001d41..44f6c75283 100644 --- a/library/cpp/messagebus/duration_histogram.cpp +++ b/library/cpp/messagebus/duration_histogram.cpp @@ -48,7 +48,7 @@ namespace { } TString TDurationHistogram::LabelBefore(unsigned i) { - Y_VERIFY(i < Buckets); + Y_VERIFY(i < Buckets); TDuration d = Singleton<TMarks>()->Marks[i]; @@ -67,8 +67,8 @@ TString TDurationHistogram::LabelBefore(unsigned i) { TString TDurationHistogram::PrintToString() const { TStringStream ss; - for (auto time : Times) { - ss << time << "\n"; + for (auto time : Times) { + ss << time << "\n"; } return ss.Str(); } diff --git a/library/cpp/messagebus/duration_histogram_ut.cpp b/library/cpp/messagebus/duration_histogram_ut.cpp index 01bcc095e9..f2fc1aa8a2 100644 --- a/library/cpp/messagebus/duration_histogram_ut.cpp +++ b/library/cpp/messagebus/duration_histogram_ut.cpp @@ -2,8 +2,8 @@ #include "duration_histogram.h" -Y_UNIT_TEST_SUITE(TDurationHistogramTest) { - Y_UNIT_TEST(BucketFor) { +Y_UNIT_TEST_SUITE(TDurationHistogramTest) { + Y_UNIT_TEST(BucketFor) { UNIT_ASSERT_VALUES_EQUAL(0u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(0))); UNIT_ASSERT_VALUES_EQUAL(0u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(1))); UNIT_ASSERT_VALUES_EQUAL(0u, TDurationHistogram::BucketFor(TDuration::MicroSeconds(900))); @@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(TDurationHistogramTest) { UNIT_ASSERT_VALUES_EQUAL(TDurationHistogram::Buckets - 1, TDurationHistogram::BucketFor(TDuration::Hours(1))); } - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TDurationHistogram h1; h1.AddTime(TDuration::MicroSeconds(1)); UNIT_ASSERT_VALUES_EQUAL(1u, h1.Times.front()); @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TDurationHistogramTest) { UNIT_ASSERT_VALUES_EQUAL(1u, h1.Times.back()); } - Y_UNIT_TEST(LabelFor) { + Y_UNIT_TEST(LabelFor) { for (unsigned i = 0; i < TDurationHistogram::Buckets; ++i) { TDurationHistogram::LabelBefore(i); //Cerr << TDurationHistogram::LabelBefore(i) << "\n"; diff --git a/library/cpp/messagebus/event_loop.cpp b/library/cpp/messagebus/event_loop.cpp index f685135bed..1dbbec1657 100644 --- a/library/cpp/messagebus/event_loop.cpp +++ b/library/cpp/messagebus/event_loop.cpp @@ -4,11 +4,11 @@ #include "thread_extra.h" #include <util/generic/hash.h> -#include <util/network/pair.h> +#include <util/network/pair.h> #include <util/network/poller.h> #include <util/system/event.h> #include <util/system/mutex.h> -#include <util/system/thread.h> +#include <util/system/thread.h> #include <util/system/yassert.h> #include <util/thread/lfqueue.h> @@ -161,7 +161,7 @@ TChannel::TImpl::TImpl(TEventLoop::TImpl* eventLoop, TSocket socket, TEventHandl } TChannel::TImpl::~TImpl() { - Y_ASSERT(Close); + Y_ASSERT(Close); } void TChannel::TImpl::EnableRead() { @@ -260,7 +260,7 @@ TEventLoop::TImpl::TImpl(const char* name) SOCKET wakeupSockets[2]; if (SocketPair(wakeupSockets) < 0) { - Y_FAIL("failed to create socket pair for wakeup sockets: %s", LastSystemErrorText()); + Y_FAIL("failed to create socket pair for wakeup sockets: %s", LastSystemErrorText()); } TSocketHolder wakeupReadSocket(wakeupSockets[0]); @@ -278,7 +278,7 @@ TEventLoop::TImpl::TImpl(const char* name) void TEventLoop::TImpl::Run() { bool res = AtomicCas(&RunningState, EVENT_LOOP_RUNNING, EVENT_LOOP_CREATED); - Y_VERIFY(res, "Invalid mbus event loop state"); + Y_VERIFY(res, "Invalid mbus event loop state"); if (!!Name) { SetCurrentThreadName(Name); @@ -286,7 +286,7 @@ void TEventLoop::TImpl::Run() { while (AtomicGet(StopSignal) == 0) { void* cookies[1024]; - const size_t count = Poller.WaitI(cookies, Y_ARRAY_SIZE(cookies)); + const size_t count = Poller.WaitI(cookies, Y_ARRAY_SIZE(cookies)); void** end = cookies + count; for (void** c = cookies; c != end; ++c) { @@ -295,7 +295,7 @@ void TEventLoop::TImpl::Run() { if (*c == this) { char buf[0x1000]; if (NBus::NPrivate::SocketRecv(WakeupReadSocket, buf) < 0) { - Y_FAIL("failed to recv from wakeup socket: %s", LastSystemErrorText()); + Y_FAIL("failed to recv from wakeup socket: %s", LastSystemErrorText()); } continue; } @@ -306,14 +306,14 @@ void TEventLoop::TImpl::Run() { SOCKET socket = -1; while (SocketsToRemove.Dequeue(&socket)) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(Data.erase(socket) == 1, "must be removed once"); + Y_VERIFY(Data.erase(socket) == 1, "must be removed once"); } } { TGuard<TMutex> guard(Mutex); - for (auto& it : Data) { - it.second->Unregister(); + for (auto& it : Data) { + it.second->Unregister(); } // release file descriptors @@ -322,7 +322,7 @@ void TEventLoop::TImpl::Run() { res = AtomicCas(&RunningState, EVENT_LOOP_STOPPED, EVENT_LOOP_RUNNING); - Y_VERIFY(res); + Y_VERIFY(res); StoppedEvent.Signal(); } @@ -338,13 +338,13 @@ void TEventLoop::TImpl::Stop() { } TChannelPtr TEventLoop::TImpl::Register(TSocket socket, TEventHandlerPtr eventHandler, void* cookie) { - Y_VERIFY(socket != INVALID_SOCKET, "must be a valid socket"); + Y_VERIFY(socket != INVALID_SOCKET, "must be a valid socket"); TChannelPtr channel = new TChannel(new TChannel::TImpl(this, socket, eventHandler, cookie)); TGuard<TMutex> guard(Mutex); - Y_VERIFY(Data.insert(std::make_pair(socket, channel)).second, "must not be already inserted"); + Y_VERIFY(Data.insert(std::make_pair(socket, channel)).second, "must not be already inserted"); return channel; } @@ -352,7 +352,7 @@ TChannelPtr TEventLoop::TImpl::Register(TSocket socket, TEventHandlerPtr eventHa void TEventLoop::TImpl::Wakeup() { if (NBus::NPrivate::SocketSend(WakeupWriteSocket, TArrayRef<const char>("", 1)) < 0) { if (LastSystemError() != EAGAIN) { - Y_FAIL("failed to send to wakeup socket: %s", LastSystemErrorText()); + Y_FAIL("failed to send to wakeup socket: %s", LastSystemErrorText()); } } } @@ -365,6 +365,6 @@ void TEventLoop::TImpl::AddToPoller(SOCKET socket, void* cookie, int flags) { } else if (flags == OP_READ_WRITE) { Poller.WaitReadWriteOneShot(socket, cookie); } else { - Y_FAIL("Wrong flags: %d", int(flags)); + Y_FAIL("Wrong flags: %d", int(flags)); } } diff --git a/library/cpp/messagebus/extra_ref.h b/library/cpp/messagebus/extra_ref.h index 2927123266..99470152fc 100644 --- a/library/cpp/messagebus/extra_ref.h +++ b/library/cpp/messagebus/extra_ref.h @@ -11,7 +11,7 @@ public: { } ~TExtraRef() { - Y_VERIFY(!Holds); + Y_VERIFY(!Holds); } template <typename TThis> diff --git a/library/cpp/messagebus/futex_like.cpp b/library/cpp/messagebus/futex_like.cpp index 7f965126db..bf3bee4ef5 100644 --- a/library/cpp/messagebus/futex_like.cpp +++ b/library/cpp/messagebus/futex_like.cpp @@ -25,13 +25,13 @@ namespace { #endif void TFutexLike::Wake(size_t count) { - Y_ASSERT(count > 0); + Y_ASSERT(count > 0); #ifdef _linux_ if (count > unsigned(Max<int>())) { count = Max<int>(); } int r = futex(&Value, FUTEX_WAKE, count, nullptr, nullptr, 0); - Y_VERIFY(r >= 0, "futex_wake failed: %s", strerror(errno)); + Y_VERIFY(r >= 0, "futex_wake failed: %s", strerror(errno)); #else TGuard<TMutex> guard(Mutex); if (count == 1) { @@ -45,7 +45,7 @@ void TFutexLike::Wake(size_t count) { void TFutexLike::Wait(int expected) { #ifdef _linux_ int r = futex(&Value, FUTEX_WAIT, expected, nullptr, nullptr, 0); - Y_VERIFY(r >= 0 || errno == EWOULDBLOCK, "futex_wait failed: %s", strerror(errno)); + Y_VERIFY(r >= 0 || errno == EWOULDBLOCK, "futex_wait failed: %s", strerror(errno)); #else TGuard<TMutex> guard(Mutex); if (expected == Get()) { diff --git a/library/cpp/messagebus/latch_ut.cpp b/library/cpp/messagebus/latch_ut.cpp index bfab04f527..51a0a8baf1 100644 --- a/library/cpp/messagebus/latch_ut.cpp +++ b/library/cpp/messagebus/latch_ut.cpp @@ -2,8 +2,8 @@ #include "latch.h" -Y_UNIT_TEST_SUITE(TLatch) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TLatch) { + Y_UNIT_TEST(Simple) { TLatch latch; UNIT_ASSERT(latch.TryWait()); latch.Lock(); diff --git a/library/cpp/messagebus/lfqueue_batch_ut.cpp b/library/cpp/messagebus/lfqueue_batch_ut.cpp index f80434c0d4..71f854e734 100644 --- a/library/cpp/messagebus/lfqueue_batch_ut.cpp +++ b/library/cpp/messagebus/lfqueue_batch_ut.cpp @@ -2,8 +2,8 @@ #include "lfqueue_batch.h" -Y_UNIT_TEST_SUITE(TLockFreeQueueBatch) { - Y_UNIT_TEST(Order1) { +Y_UNIT_TEST_SUITE(TLockFreeQueueBatch) { + Y_UNIT_TEST(Order1) { TLockFreeQueueBatch<unsigned> q; { TAutoPtr<TVector<unsigned>> v(new TVector<unsigned>); @@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TLockFreeQueueBatch) { UNIT_ASSERT_VALUES_EQUAL(0u, r.size()); } - Y_UNIT_TEST(Order2) { + Y_UNIT_TEST(Order2) { TLockFreeQueueBatch<unsigned> q; { TAutoPtr<TVector<unsigned>> v(new TVector<unsigned>); diff --git a/library/cpp/messagebus/local_flags_ut.cpp b/library/cpp/messagebus/local_flags_ut.cpp index 189d73eb0f..afa8ac1a29 100644 --- a/library/cpp/messagebus/local_flags_ut.cpp +++ b/library/cpp/messagebus/local_flags_ut.cpp @@ -5,8 +5,8 @@ using namespace NBus; using namespace NBus::NPrivate; -Y_UNIT_TEST_SUITE(EMessageLocalFlags) { - Y_UNIT_TEST(TestLocalFlagSetToString) { +Y_UNIT_TEST_SUITE(EMessageLocalFlags) { + Y_UNIT_TEST(TestLocalFlagSetToString) { UNIT_ASSERT_VALUES_EQUAL("0", LocalFlagSetToString(0)); UNIT_ASSERT_VALUES_EQUAL("MESSAGE_REPLY_INTERNAL", LocalFlagSetToString(MESSAGE_REPLY_INTERNAL)); diff --git a/library/cpp/messagebus/memory_ut.cpp b/library/cpp/messagebus/memory_ut.cpp index 00654f28a1..8ceeca5f86 100644 --- a/library/cpp/messagebus/memory_ut.cpp +++ b/library/cpp/messagebus/memory_ut.cpp @@ -2,8 +2,8 @@ #include "memory.h" -Y_UNIT_TEST_SUITE(MallocAligned) { - Y_UNIT_TEST(Test) { +Y_UNIT_TEST_SUITE(MallocAligned) { + Y_UNIT_TEST(Test) { for (size_t size = 0; size < 1000; ++size) { void* ptr = MallocAligned(size, 128); UNIT_ASSERT(uintptr_t(ptr) % 128 == 0); diff --git a/library/cpp/messagebus/message.cpp b/library/cpp/messagebus/message.cpp index bfa7ed8e9b..8e2a5cdd58 100644 --- a/library/cpp/messagebus/message.cpp +++ b/library/cpp/messagebus/message.cpp @@ -193,6 +193,6 @@ namespace NBus { } template <> -void Out<TBusIdentity>(IOutputStream& os, TTypeTraits<TBusIdentity>::TFuncParam ident) { +void Out<TBusIdentity>(IOutputStream& os, TTypeTraits<TBusIdentity>::TFuncParam ident) { os << ident.ToString(); } diff --git a/library/cpp/messagebus/message_counter.cpp b/library/cpp/messagebus/message_counter.cpp index 04d9343f6a..9b7cad9c46 100644 --- a/library/cpp/messagebus/message_counter.cpp +++ b/library/cpp/messagebus/message_counter.cpp @@ -25,7 +25,7 @@ TMessageCounter& TMessageCounter::operator+=(const TMessageCounter& that) { TString TMessageCounter::ToString(bool reader) const { if (reader) { - Y_ASSERT(CountCompressionRequests == 0); + Y_ASSERT(CountCompressionRequests == 0); } TStringStream readValue; diff --git a/library/cpp/messagebus/message_status_counter.cpp b/library/cpp/messagebus/message_status_counter.cpp index 891c8f5bb2..8a6ea01460 100644 --- a/library/cpp/messagebus/message_status_counter.cpp +++ b/library/cpp/messagebus/message_status_counter.cpp @@ -28,14 +28,14 @@ TString TMessageStatusCounter::PrintToString() const { bool hasZeros = false; for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) { if (i == MESSAGE_OK) { - Y_VERIFY(Counts[i] == 0); + Y_VERIFY(Counts[i] == 0); continue; } if (Counts[i] != 0) { p.AddRow(EMessageStatus(i), Counts[i]); const char* description = MessageStatusDescription(EMessageStatus(i)); // TODO: add third column - Y_UNUSED(description); + Y_UNUSED(description); hasNonZeros = true; } else { @@ -59,7 +59,7 @@ void TMessageStatusCounter::FillErrorsProtobuf(TConnectionStatusMonRecord* statu status->clear_errorcountbystatus(); for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) { if (i == MESSAGE_OK) { - Y_VERIFY(Counts[i] == 0); + Y_VERIFY(Counts[i] == 0); continue; } if (Counts[i] != 0) { diff --git a/library/cpp/messagebus/message_status_counter_ut.cpp b/library/cpp/messagebus/message_status_counter_ut.cpp index 9598651329..c5b7895490 100644 --- a/library/cpp/messagebus/message_status_counter_ut.cpp +++ b/library/cpp/messagebus/message_status_counter_ut.cpp @@ -7,8 +7,8 @@ using namespace NBus; using namespace NBus::NPrivate; -Y_UNIT_TEST_SUITE(MessageStatusCounter) { - Y_UNIT_TEST(MessageStatusConversion) { +Y_UNIT_TEST_SUITE(MessageStatusCounter) { + Y_UNIT_TEST(MessageStatusConversion) { const ::google::protobuf::EnumDescriptor* descriptor = TMessageStatusRecord_EMessageStatus_descriptor(); diff --git a/library/cpp/messagebus/messqueue.cpp b/library/cpp/messagebus/messqueue.cpp index 3474d62705..9b55f9061d 100644 --- a/library/cpp/messagebus/messqueue.cpp +++ b/library/cpp/messagebus/messqueue.cpp @@ -169,7 +169,7 @@ void TBusMessageQueue::Add(TIntrusivePtr<TBusSessionImpl> session) { void TBusMessageQueue::Remove(TBusSession* session) { TGuard<TMutex> scope(Lock); TList<TIntrusivePtr<TBusSessionImpl>>::iterator it = std::find(Sessions.begin(), Sessions.end(), session); - Y_VERIFY(it != Sessions.end(), "do not destroy session twice"); + Y_VERIFY(it != Sessions.end(), "do not destroy session twice"); Sessions.erase(it); } @@ -184,8 +184,8 @@ void TBusMessageQueue::DestroyAllSessions() { sessions = Sessions; } - for (auto& session : sessions) { - Y_VERIFY(session->IsDown(), "Session must be shut down prior to queue shutdown"); + for (auto& session : sessions) { + Y_VERIFY(session->IsDown(), "Session must be shut down prior to queue shutdown"); } } diff --git a/library/cpp/messagebus/misc/test_sync.h b/library/cpp/messagebus/misc/test_sync.h index be3f4f20b8..a74b5d6f3b 100644 --- a/library/cpp/messagebus/misc/test_sync.h +++ b/library/cpp/messagebus/misc/test_sync.h @@ -32,7 +32,7 @@ public: void WaitFor(unsigned n) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(Current <= n, "too late, waiting for %d, already %d", n, Current); + Y_VERIFY(Current <= n, "too late, waiting for %d, already %d", n, Current); while (n > Current) { CondVar.WaitI(Mutex); @@ -42,7 +42,7 @@ public: void WaitForAndIncrement(unsigned n) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(Current <= n, "too late, waiting for %d, already %d", n, Current); + Y_VERIFY(Current <= n, "too late, waiting for %d, already %d", n, Current); while (n > Current) { CondVar.WaitI(Mutex); @@ -55,7 +55,7 @@ public: void CheckAndIncrement(unsigned n) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(Current == n, "must be %d, currently %d", n, Current); + Y_VERIFY(Current == n, "must be %d, currently %d", n, Current); DoInc(); CondVar.BroadCast(); @@ -64,12 +64,12 @@ public: void Check(unsigned n) { TGuard<TMutex> guard(Mutex); - Y_VERIFY(Current == n, "must be %d, currently %d", n, Current); + Y_VERIFY(Current == n, "must be %d, currently %d", n, Current); } private: void DoInc() { unsigned r = ++Current; - Y_UNUSED(r); + Y_UNUSED(r); } }; diff --git a/library/cpp/messagebus/misc/tokenquota.h b/library/cpp/messagebus/misc/tokenquota.h index 190547fa54..96b5f7c4b9 100644 --- a/library/cpp/messagebus/misc/tokenquota.h +++ b/library/cpp/messagebus/misc/tokenquota.h @@ -22,7 +22,7 @@ namespace NBus { , WakeLev(wake < 1 ? Max<size_t>(1, tokens / 2) : 0) , Tokens_(tokens) { - Y_UNUSED(padd_); + Y_UNUSED(padd_); } bool Acquire(TAtomic level = 1, bool force = false) { @@ -37,7 +37,7 @@ namespace NBus { void Consume(size_t items) { if (Enabled) { - Y_ASSERT(Acquired >= TAtomicBase(items)); + Y_ASSERT(Acquired >= TAtomicBase(items)); Acquired -= items; } diff --git a/library/cpp/messagebus/misc/weak_ptr.h b/library/cpp/messagebus/misc/weak_ptr.h index 70fdeb0e2a..20afeafa88 100644 --- a/library/cpp/messagebus/misc/weak_ptr.h +++ b/library/cpp/messagebus/misc/weak_ptr.h @@ -23,13 +23,13 @@ private: void Release() { TGuard<TMutex> g(Mutex); - Y_ASSERT(!!Outer); + Y_ASSERT(!!Outer); Outer = nullptr; } TIntrusivePtr<TSelf> Get() { TGuard<TMutex> g(Mutex); - Y_ASSERT(!Outer || Outer->RefCount() > 0); + Y_ASSERT(!Outer || Outer->RefCount() > 0); return Outer; } }; diff --git a/library/cpp/messagebus/misc/weak_ptr_ut.cpp b/library/cpp/messagebus/misc/weak_ptr_ut.cpp index 5a325278db..b499ca7b1d 100644 --- a/library/cpp/messagebus/misc/weak_ptr_ut.cpp +++ b/library/cpp/messagebus/misc/weak_ptr_ut.cpp @@ -2,7 +2,7 @@ #include "weak_ptr.h" -Y_UNIT_TEST_SUITE(TWeakPtrTest) { +Y_UNIT_TEST_SUITE(TWeakPtrTest) { struct TWeakPtrTester: public TWeakRefCounted<TWeakPtrTester> { int* const CounterPtr; @@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(TWeakPtrTest) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { int destroyCount = 0; TIntrusivePtr<TWeakPtrTester> p(new TWeakPtrTester(&destroyCount)); diff --git a/library/cpp/messagebus/moved_ut.cpp b/library/cpp/messagebus/moved_ut.cpp index c1a07cce7e..5345b81947 100644 --- a/library/cpp/messagebus/moved_ut.cpp +++ b/library/cpp/messagebus/moved_ut.cpp @@ -2,8 +2,8 @@ #include "moved.h" -Y_UNIT_TEST_SUITE(TMovedTest) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TMovedTest) { + Y_UNIT_TEST(Simple) { TMoved<THolder<int>> h1(MakeHolder<int>(10)); TMoved<THolder<int>> h2 = h1; UNIT_ASSERT(!*h1); @@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(TMovedTest) { UNIT_ASSERT_VALUES_EQUAL(11, **h); } - Y_UNIT_TEST(PassToFunction) { + Y_UNIT_TEST(PassToFunction) { THolder<int> h(new int(11)); Foo(h); } diff --git a/library/cpp/messagebus/netaddr_ut.cpp b/library/cpp/messagebus/netaddr_ut.cpp index e5c68bf402..63b688e53b 100644 --- a/library/cpp/messagebus/netaddr_ut.cpp +++ b/library/cpp/messagebus/netaddr_ut.cpp @@ -5,17 +5,17 @@ using namespace NBus; -Y_UNIT_TEST_SUITE(TNetAddr) { - Y_UNIT_TEST(ResolveIpv4) { +Y_UNIT_TEST_SUITE(TNetAddr) { + Y_UNIT_TEST(ResolveIpv4) { ASSUME_IP_V4_ENABLED; UNIT_ASSERT(TNetAddr("ns1.yandex.ru", 80, EIP_VERSION_4).IsIpv4()); } - Y_UNIT_TEST(ResolveIpv6) { + Y_UNIT_TEST(ResolveIpv6) { UNIT_ASSERT(TNetAddr("ns1.yandex.ru", 80, EIP_VERSION_6).IsIpv6()); } - Y_UNIT_TEST(ResolveAny) { + Y_UNIT_TEST(ResolveAny) { TNetAddr("ns1.yandex.ru", 80, EIP_VERSION_ANY); } } diff --git a/library/cpp/messagebus/network.cpp b/library/cpp/messagebus/network.cpp index 304bedae5a..7fe03a9010 100644 --- a/library/cpp/messagebus/network.cpp +++ b/library/cpp/messagebus/network.cpp @@ -11,7 +11,7 @@ using namespace NBus::NPrivate; namespace { TBindResult BindOnPortProto(int port, int af, bool reusePort) { - Y_VERIFY(af == AF_INET || af == AF_INET6, "wrong af"); + Y_VERIFY(af == AF_INET || af == AF_INET6, "wrong af"); SOCKET fd = ::socket(af, SOCK_STREAM, 0); if (fd == INVALID_SOCKET) { @@ -126,8 +126,8 @@ void NBus::NPrivate::SetSockOptTcpCork(SOCKET s, bool value) { #ifdef _linux_ CheckedSetSockOpt(s, IPPROTO_TCP, TCP_CORK, (int)value, "TCP_CORK"); #else - Y_UNUSED(s); - Y_UNUSED(value); + Y_UNUSED(s); + Y_UNUSED(value); #endif } @@ -138,7 +138,7 @@ ssize_t NBus::NPrivate::SocketSend(SOCKET s, TArrayRef<const char> data) { #endif ssize_t r = ::send(s, data.data(), data.size(), flags); if (r < 0) { - Y_VERIFY(LastSystemError() != EBADF, "bad fd"); + Y_VERIFY(LastSystemError() != EBADF, "bad fd"); } return r; } @@ -150,7 +150,7 @@ ssize_t NBus::NPrivate::SocketRecv(SOCKET s, TArrayRef<char> buffer) { #endif ssize_t r = ::recv(s, buffer.data(), buffer.size(), flags); if (r < 0) { - Y_VERIFY(LastSystemError() != EBADF, "bad fd"); + Y_VERIFY(LastSystemError() != EBADF, "bad fd"); } return r; } diff --git a/library/cpp/messagebus/network_ut.cpp b/library/cpp/messagebus/network_ut.cpp index f1798419db..05f4cb6354 100644 --- a/library/cpp/messagebus/network_ut.cpp +++ b/library/cpp/messagebus/network_ut.cpp @@ -31,8 +31,8 @@ namespace { } } -Y_UNIT_TEST_SUITE(Network) { - Y_UNIT_TEST(BindOnPortConcrete) { +Y_UNIT_TEST_SUITE(Network) { + Y_UNIT_TEST(BindOnPortConcrete) { if (!IsFixedPortTestAllowed()) { return; } @@ -45,7 +45,7 @@ Y_UNIT_TEST_SUITE(Network) { } } - Y_UNIT_TEST(BindOnPortRandom) { + Y_UNIT_TEST(BindOnPortRandom) { TVector<TBindResult> r = BindOnPort(0, false).second; UNIT_ASSERT_VALUES_EQUAL(size_t(2), r.size()); @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(Network) { UNIT_ASSERT_VALUES_EQUAL(r.at(0).Addr.GetPort(), r.at(1).Addr.GetPort()); } - Y_UNIT_TEST(BindOnBusyPort) { + Y_UNIT_TEST(BindOnBusyPort) { auto r = BindOnPort(0, false); UNIT_ASSERT_EXCEPTION_CONTAINS(BindOnPort(r.first, false), TSystemError, "failed to bind on port " + ToString(r.first)); diff --git a/library/cpp/messagebus/nondestroying_holder.h b/library/cpp/messagebus/nondestroying_holder.h index f4725d696f..b7d4efd2b4 100644 --- a/library/cpp/messagebus/nondestroying_holder.h +++ b/library/cpp/messagebus/nondestroying_holder.h @@ -16,7 +16,7 @@ public: } ~TNonDestroyingHolder() { - Y_VERIFY(!*this, "stored object must be explicitly released"); + Y_VERIFY(!*this, "stored object must be explicitly released"); } }; @@ -34,6 +34,6 @@ public: } inline ~TNonDestroyingAutoPtr() { - Y_VERIFY(!*this, "stored object must be explicitly released"); + Y_VERIFY(!*this, "stored object must be explicitly released"); } }; diff --git a/library/cpp/messagebus/nondestroying_holder_ut.cpp b/library/cpp/messagebus/nondestroying_holder_ut.cpp index 208042a2ba..02a417a8fe 100644 --- a/library/cpp/messagebus/nondestroying_holder_ut.cpp +++ b/library/cpp/messagebus/nondestroying_holder_ut.cpp @@ -2,8 +2,8 @@ #include "nondestroying_holder.h" -Y_UNIT_TEST_SUITE(TNonDestroyingHolder) { - Y_UNIT_TEST(ToAutoPtr) { +Y_UNIT_TEST_SUITE(TNonDestroyingHolder) { + Y_UNIT_TEST(ToAutoPtr) { TNonDestroyingHolder<int> h(new int(11)); TAutoPtr<int> i(h); UNIT_ASSERT_VALUES_EQUAL(11, *i); diff --git a/library/cpp/messagebus/oldmodule/module.cpp b/library/cpp/messagebus/oldmodule/module.cpp index 24bd778799..fd08e223e8 100644 --- a/library/cpp/messagebus/oldmodule/module.cpp +++ b/library/cpp/messagebus/oldmodule/module.cpp @@ -774,7 +774,7 @@ void TBusModuleImpl::DestroyJob(TJobRunner* job) { { TWhatThreadDoesAcquireGuard<TMutex> G(Lock, "modules: acquiring lock for DestroyJob"); int jobCount = AtomicDecrement(JobCount); - Y_VERIFY(jobCount >= 0, "decremented too much"); + Y_VERIFY(jobCount >= 0, "decremented too much"); Jobs.erase(job->JobStorageIterator); if (AtomicGet(State) == STOPPED) { @@ -789,7 +789,7 @@ void TBusModuleImpl::DestroyJob(TJobRunner* job) { void TBusModuleImpl::OnMessageReceived(TAutoPtr<TBusMessage> msg0, TOnMessageContext& context) { TBusMessage* msg = !!msg0 ? msg0.Get() : context.GetMessage(); - Y_VERIFY(!!msg); + Y_VERIFY(!!msg); THolder<TJobRunner> jobRunner(new TJobRunner(Module->CreateJobInstance(msg))); jobRunner->Job->MessageHolder.Reset(msg0.Release()); @@ -810,11 +810,11 @@ void TBusModuleImpl::Shutdown() { } AtomicSet(State, TBusModuleImpl::STOPPED); - for (auto& clientSession : ClientSessions) { - clientSession->Shutdown(); + for (auto& clientSession : ClientSessions) { + clientSession->Shutdown(); } - for (auto& serverSession : ServerSessions) { - serverSession->Shutdown(); + for (auto& serverSession : ServerSessions) { + serverSession->Shutdown(); } for (size_t starter = 0; starter < Starters.size(); ++starter) { @@ -823,8 +823,8 @@ void TBusModuleImpl::Shutdown() { { TWhatThreadDoesAcquireGuard<TMutex> guard(Lock, "modules: acquiring lock for Shutdown"); - for (auto& Job : Jobs) { - Job->Schedule(); + for (auto& Job : Jobs) { + Job->Schedule(); } while (!Jobs.empty()) { @@ -834,8 +834,8 @@ void TBusModuleImpl::Shutdown() { } EMessageStatus TBusModule::StartJob(TAutoPtr<TBusMessage> message) { - Y_VERIFY(Impl->State == TBusModuleImpl::RUNNING); - Y_VERIFY(!!Impl->Queue); + Y_VERIFY(Impl->State == TBusModuleImpl::RUNNING); + Y_VERIFY(!!Impl->Queue); if ((unsigned)AtomicGet(Impl->JobCount) >= Impl->ModuleConfig.StarterMaxInFlight) { return MESSAGE_BUSY; @@ -853,16 +853,16 @@ void TModuleServerHandler::OnMessage(TOnMessageContext& msg) { void TModuleClientHandler::OnReply(TAutoPtr<TBusMessage> req, TAutoPtr<TBusMessage> resp) { TJobRunner* job = GetJob(req.Get()); - Y_ASSERT(job); - Y_ASSERT(job->Job->Message != req.Get()); + Y_ASSERT(job); + Y_ASSERT(job->Job->Message != req.Get()); job->EnqueueAndSchedule(TJobResponseMessage(req.Release(), resp.Release(), MESSAGE_OK)); job->UnRef(); } void TModuleClientHandler::OnMessageSentOneWay(TAutoPtr<TBusMessage> req) { TJobRunner* job = GetJob(req.Get()); - Y_ASSERT(job); - Y_ASSERT(job->Job->Message != req.Get()); + Y_ASSERT(job); + Y_ASSERT(job->Job->Message != req.Get()); job->EnqueueAndSchedule(TJobResponseMessage(req.Release(), nullptr, MESSAGE_OK)); job->UnRef(); } @@ -870,7 +870,7 @@ void TModuleClientHandler::OnMessageSentOneWay(TAutoPtr<TBusMessage> req) { void TModuleClientHandler::OnError(TAutoPtr<TBusMessage> msg, EMessageStatus status) { TJobRunner* job = GetJob(msg.Get()); if (job) { - Y_ASSERT(job->Job->Message != msg.Get()); + Y_ASSERT(job->Job->Message != msg.Get()); job->EnqueueAndSchedule(TJobResponseMessage(msg.Release(), nullptr, status)); job->UnRef(); } diff --git a/library/cpp/messagebus/protobuf/ybusbuf.cpp b/library/cpp/messagebus/protobuf/ybusbuf.cpp index 63415b3737..ac4b5a9d17 100644 --- a/library/cpp/messagebus/protobuf/ybusbuf.cpp +++ b/library/cpp/messagebus/protobuf/ybusbuf.cpp @@ -12,8 +12,8 @@ TBusBufferProtocol::TBusBufferProtocol(TBusService name, int port) } TBusBufferProtocol::~TBusBufferProtocol() { - for (auto& type : Types) { - delete type; + for (auto& type : Types) { + delete type; } } @@ -47,7 +47,7 @@ void TBusBufferProtocol::Serialize(const TBusMessage* mess, TBuffer& data) { const TBusHeader* header = mess->GetHeader(); if (!IsRegisteredType(header->Type)) { - Y_FAIL("unknown message type: %d", int(header->Type)); + Y_FAIL("unknown message type: %d", int(header->Type)); return; } @@ -58,7 +58,7 @@ void TBusBufferProtocol::Serialize(const TBusMessage* mess, TBuffer& data) { data.Reserve(data.Size() + size); char* after = (char*)bmess->GetRecord()->SerializeWithCachedSizesToArray((ui8*)data.Pos()); - Y_VERIFY(after - data.Pos() == size); + Y_VERIFY(after - data.Pos() == size); data.Advance(size); } @@ -69,7 +69,7 @@ TAutoPtr<TBusMessage> TBusBufferProtocol::Deserialize(ui16 messageType, TArrayRe TBusBufferBase* messageTemplate = FindType(messageType); if (messageTemplate == nullptr) { return nullptr; - //Y_FAIL("unknown message type: %d", unsigned(messageType)); + //Y_FAIL("unknown message type: %d", unsigned(messageType)); } // clone the base diff --git a/library/cpp/messagebus/rain_check/core/coro.cpp b/library/cpp/messagebus/rain_check/core/coro.cpp index 500841dd5b..c79c6dfc5b 100644 --- a/library/cpp/messagebus/rain_check/core/coro.cpp +++ b/library/cpp/messagebus/rain_check/core/coro.cpp @@ -23,7 +23,7 @@ TCoroTaskRunner::TCoroTaskRunner(IEnv* env, ISubtaskListener* parent, TAutoPtr<I } TCoroTaskRunner::~TCoroTaskRunner() { - Y_ASSERT(CoroDone); + Y_ASSERT(CoroDone); } Y_POD_STATIC_THREAD(TContMachineContext*) @@ -32,7 +32,7 @@ Y_POD_STATIC_THREAD(TCoroTaskRunner*) Task; bool TCoroTaskRunner::ReplyReceived() { - Y_ASSERT(!CoroDone); + Y_ASSERT(!CoroDone); TContMachineContext me; @@ -43,8 +43,8 @@ bool TCoroTaskRunner::ReplyReceived() { Stack.VerifyNoStackOverflow(); - Y_ASSERT(CallerContext == &me); - Y_ASSERT(Task == this); + Y_ASSERT(CallerContext == &me); + Y_ASSERT(Task == this); return !CoroDone; } diff --git a/library/cpp/messagebus/rain_check/core/coro_stack.cpp b/library/cpp/messagebus/rain_check/core/coro_stack.cpp index 83b984ca6e..e4517393e4 100644 --- a/library/cpp/messagebus/rain_check/core/coro_stack.cpp +++ b/library/cpp/messagebus/rain_check/core/coro_stack.cpp @@ -12,8 +12,8 @@ using namespace NRainCheck::NPrivate; TCoroStack::TCoroStack(size_t size) : SizeValue(size) { - Y_VERIFY(size % sizeof(ui32) == 0); - Y_VERIFY(size >= 0x1000); + Y_VERIFY(size % sizeof(ui32) == 0); + Y_VERIFY(size >= 0x1000); DataHolder.Reset(malloc(size)); diff --git a/library/cpp/messagebus/rain_check/core/coro_ut.cpp b/library/cpp/messagebus/rain_check/core/coro_ut.cpp index 61a33584a5..7157230da7 100644 --- a/library/cpp/messagebus/rain_check/core/coro_ut.cpp +++ b/library/cpp/messagebus/rain_check/core/coro_ut.cpp @@ -7,7 +7,7 @@ using namespace NRainCheck; -Y_UNIT_TEST_SUITE(RainCheckCoro) { +Y_UNIT_TEST_SUITE(RainCheckCoro) { struct TSimpleCoroTask : ICoroTask { TTestSync* const TestSync; @@ -21,7 +21,7 @@ Y_UNIT_TEST_SUITE(RainCheckCoro) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TTestSync testSync; TTestEnv env; @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(RainCheckCoro) { } }; - Y_UNIT_TEST(Sleep) { + Y_UNIT_TEST(Sleep) { TTestSync testSync; TTestEnv env; @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(RainCheckCoro) { } }; - Y_UNIT_TEST(Spawn) { + Y_UNIT_TEST(Spawn) { TTestSync testSync; TTestEnv env; diff --git a/library/cpp/messagebus/rain_check/core/simple.cpp b/library/cpp/messagebus/rain_check/core/simple.cpp index 70182b2f93..22e721758e 100644 --- a/library/cpp/messagebus/rain_check/core/simple.cpp +++ b/library/cpp/messagebus/rain_check/core/simple.cpp @@ -9,7 +9,7 @@ TSimpleTaskRunner::TSimpleTaskRunner(IEnv* env, ISubtaskListener* parentTask, TA } TSimpleTaskRunner::~TSimpleTaskRunner() { - Y_ASSERT(!ContinueFunc); + Y_ASSERT(!ContinueFunc); } bool TSimpleTaskRunner::ReplyReceived() { diff --git a/library/cpp/messagebus/rain_check/core/simple_ut.cpp b/library/cpp/messagebus/rain_check/core/simple_ut.cpp index d4545e05aa..2eb5fad8f9 100644 --- a/library/cpp/messagebus/rain_check/core/simple_ut.cpp +++ b/library/cpp/messagebus/rain_check/core/simple_ut.cpp @@ -8,7 +8,7 @@ using namespace NRainCheck; -Y_UNIT_TEST_SUITE(RainCheckSimple) { +Y_UNIT_TEST_SUITE(RainCheckSimple) { struct TTaskWithCompletionCallback: public ISimpleTask { TTestEnv* const Env; TTestSync* const TestSync; @@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(RainCheckSimple) { } void SleepCompletionCallback(TSubtaskCompletion* completion) { - Y_VERIFY(completion == &SleepCompletion); + Y_VERIFY(completion == &SleepCompletion); TestSync->CheckAndIncrement(1); Env->SleepService.Sleep(&SleepCompletion, TDuration::MilliSeconds(1)); @@ -48,7 +48,7 @@ Y_UNIT_TEST_SUITE(RainCheckSimple) { } }; - Y_UNIT_TEST(CompletionCallback) { + Y_UNIT_TEST(CompletionCallback) { TTestEnv env; TTestSync testSync; diff --git a/library/cpp/messagebus/rain_check/core/sleep_ut.cpp b/library/cpp/messagebus/rain_check/core/sleep_ut.cpp index 2ae85a87b1..f38daf75d6 100644 --- a/library/cpp/messagebus/rain_check/core/sleep_ut.cpp +++ b/library/cpp/messagebus/rain_check/core/sleep_ut.cpp @@ -7,7 +7,7 @@ using namespace NRainCheck; using namespace NActor; -Y_UNIT_TEST_SUITE(Sleep) { +Y_UNIT_TEST_SUITE(Sleep) { struct TTestTask: public ISimpleTask { TSimpleEnv* const Env; TTestSync* const TestSync; @@ -34,7 +34,7 @@ Y_UNIT_TEST_SUITE(Sleep) { } }; - Y_UNIT_TEST(Test) { + Y_UNIT_TEST(Test) { TTestSync testSync; TSimpleEnv env; diff --git a/library/cpp/messagebus/rain_check/core/spawn_ut.cpp b/library/cpp/messagebus/rain_check/core/spawn_ut.cpp index ba5a5e41cf..3aefde88f7 100644 --- a/library/cpp/messagebus/rain_check/core/spawn_ut.cpp +++ b/library/cpp/messagebus/rain_check/core/spawn_ut.cpp @@ -12,7 +12,7 @@ using namespace NRainCheck; using namespace NActor; -Y_UNIT_TEST_SUITE(Spawn) { +Y_UNIT_TEST_SUITE(Spawn) { struct TTestTask: public ISimpleTask { TTestSync* const TestSync; @@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(Spawn) { } }; - Y_UNIT_TEST(Continuation) { + Y_UNIT_TEST(Continuation) { TTestSync testSync; TSimpleEnv env; @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(Spawn) { } }; - Y_UNIT_TEST(Subtask) { + Y_UNIT_TEST(Subtask) { TTestSync testSync; TTestEnv env; @@ -124,8 +124,8 @@ Y_UNIT_TEST_SUITE(Spawn) { return nullptr; } - for (auto& subtask : Subtasks) { - SpawnSubtask<TNopSimpleTask>(Env, &subtask, ""); + for (auto& subtask : Subtasks) { + SpawnSubtask<TNopSimpleTask>(Env, &subtask, ""); } ++I; @@ -133,7 +133,7 @@ Y_UNIT_TEST_SUITE(Spawn) { } }; - Y_UNIT_TEST(SubtaskLong) { + Y_UNIT_TEST(SubtaskLong) { TTestSync testSync; TTestEnv env; diff --git a/library/cpp/messagebus/rain_check/core/task.cpp b/library/cpp/messagebus/rain_check/core/task.cpp index a098437d53..3094890ed5 100644 --- a/library/cpp/messagebus/rain_check/core/task.cpp +++ b/library/cpp/messagebus/rain_check/core/task.cpp @@ -31,7 +31,7 @@ TTaskRunnerBase::TTaskRunnerBase(IEnv* env, ISubtaskListener* parentTask, TAutoP } TTaskRunnerBase::~TTaskRunnerBase() { - Y_ASSERT(Done); + Y_ASSERT(Done); } namespace { @@ -40,19 +40,19 @@ namespace { TRunningInThisThreadGuard(TTaskRunnerBase* task) : Task(task) { - Y_ASSERT(!ThreadCurrentTask); + Y_ASSERT(!ThreadCurrentTask); ThreadCurrentTask = task; } ~TRunningInThisThreadGuard() { - Y_ASSERT(ThreadCurrentTask == Task); + Y_ASSERT(ThreadCurrentTask == Task); ThreadCurrentTask = nullptr; } }; } void NRainCheck::TTaskRunnerBase::Act(NActor::TDefaultTag) { - Y_ASSERT(RefCount() > 0); + Y_ASSERT(RefCount() > 0); TRunningInThisThreadGuard g(this); @@ -63,11 +63,11 @@ void NRainCheck::TTaskRunnerBase::Act(NActor::TDefaultTag) { temp.GetVector()->swap(Pending); - for (auto& pending : *temp.GetVector()) { - if (pending->IsComplete()) { - pending->FireCompletionCallback(GetImplBase()); + for (auto& pending : *temp.GetVector()) { + if (pending->IsComplete()) { + pending->FireCompletionCallback(GetImplBase()); } else { - Pending.push_back(pending); + Pending.push_back(pending); } } @@ -96,11 +96,11 @@ bool TTaskRunnerBase::IsRunningInThisThread() const { TSubtaskCompletion::~TSubtaskCompletion() { ESubtaskState state = State.Get(); - Y_ASSERT(state == CREATED || state == DONE || state == CANCELED); + Y_ASSERT(state == CREATED || state == DONE || state == CANCELED); } void TSubtaskCompletion::FireCompletionCallback(ITaskBase* task) { - Y_ASSERT(IsComplete()); + Y_ASSERT(IsComplete()); if (!!CompletionFunc) { TSubtaskCompletionFunc temp = CompletionFunc; @@ -130,8 +130,8 @@ void NRainCheck::TSubtaskCompletion::Cancel() { } void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) { - Y_ASSERT(!TaskRunner); - Y_ASSERT(!!parent); + Y_ASSERT(!TaskRunner); + Y_ASSERT(!!parent); TaskRunner = parent; @@ -142,7 +142,7 @@ void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) { for (;;) { ESubtaskState current = State.Get(); if (current != CREATED && current != DONE) { - Y_FAIL("current state should be CREATED or DONE: %s", ToCString(current)); + Y_FAIL("current state should be CREATED or DONE: %s", ToCString(current)); } if (State.CompareAndSet(current, RUNNING)) { return; @@ -151,7 +151,7 @@ void TSubtaskCompletion::SetRunning(TTaskRunnerBase* parent) { } void TSubtaskCompletion::SetDone() { - Y_ASSERT(!!TaskRunner); + Y_ASSERT(!!TaskRunner); TTaskRunnerBase* temp = TaskRunner; TaskRunner = nullptr; @@ -166,7 +166,7 @@ void TSubtaskCompletion::SetDone() { break; } } else { - Y_FAIL("cannot SetDone: unknown state: %s", ToCString(state)); + Y_FAIL("cannot SetDone: unknown state: %s", ToCString(state)); } } @@ -195,11 +195,11 @@ void NRainCheck::TTaskRunnerBase::ReleaseRef() #endif void TTaskRunnerBase::AssertInThisThread() const { - Y_ASSERT(IsRunningInThisThread()); + Y_ASSERT(IsRunningInThisThread()); } TTaskRunnerBase* TTaskRunnerBase::CurrentTask() { - Y_VERIFY(!!ThreadCurrentTask); + Y_VERIFY(!!ThreadCurrentTask); return ThreadCurrentTask; } diff --git a/library/cpp/messagebus/rain_check/core/track.cpp b/library/cpp/messagebus/rain_check/core/track.cpp index 092a51a214..d41f6884ba 100644 --- a/library/cpp/messagebus/rain_check/core/track.cpp +++ b/library/cpp/messagebus/rain_check/core/track.cpp @@ -17,7 +17,7 @@ TTaskTracker::TTaskTracker(NActor::TExecutor* executor) } TTaskTracker::~TTaskTracker() { - Y_ASSERT(Tasks.Empty()); + Y_ASSERT(Tasks.Empty()); } void TTaskTracker::Shutdown() { @@ -36,7 +36,7 @@ void TTaskTracker::ProcessItem(NActor::TDefaultTag, NActor::TDefaultTag, ITaskFa } void TTaskTracker::ProcessItem(NActor::TDefaultTag, NActor::TDefaultTag, TTaskTrackerReceipt* receipt) { - Y_ASSERT(!receipt->Empty()); + Y_ASSERT(!receipt->Empty()); receipt->Unlink(); delete receipt; } diff --git a/library/cpp/messagebus/rain_check/core/track_ut.cpp b/library/cpp/messagebus/rain_check/core/track_ut.cpp index 05f7de1319..22b9b65fe1 100644 --- a/library/cpp/messagebus/rain_check/core/track_ut.cpp +++ b/library/cpp/messagebus/rain_check/core/track_ut.cpp @@ -7,7 +7,7 @@ using namespace NRainCheck; -Y_UNIT_TEST_SUITE(TaskTracker) { +Y_UNIT_TEST_SUITE(TaskTracker) { struct TTaskForTracker: public ISimpleTask { TTestSync* const TestSync; @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TaskTracker) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TTestEnv env; TIntrusivePtr<TTaskTracker> tracker(new TTaskTracker(env.GetExecutor())); diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp index 1628114391..07941acdf5 100644 --- a/library/cpp/messagebus/rain_check/http/client_ut.cpp +++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp @@ -141,10 +141,10 @@ namespace { } // anonymous namespace -Y_UNIT_TEST_SUITE(RainCheckHttpClient) { +Y_UNIT_TEST_SUITE(RainCheckHttpClient) { static const TIpPort SERVER_PORT = 4000; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { // TODO: randomize port if (!IsFixedPortTestAllowed()) { return; @@ -159,7 +159,7 @@ Y_UNIT_TEST_SUITE(RainCheckHttpClient) { env.TestSync.WaitForAndIncrement(1); } - Y_UNIT_TEST(SimplePost) { + Y_UNIT_TEST(SimplePost) { // TODO: randomize port if (!IsFixedPortTestAllowed()) { return; @@ -174,7 +174,7 @@ Y_UNIT_TEST_SUITE(RainCheckHttpClient) { env.TestSync.WaitForAndIncrement(1); } - Y_UNIT_TEST(HttpCodeExtraction) { + Y_UNIT_TEST(HttpCodeExtraction) { // Find "request failed(" string, then copy len("HTTP/1.X NNN") chars and try to convert NNN to HTTP code. #define CHECK_VALID_LINE(line, code) \ diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_client.cpp b/library/cpp/messagebus/rain_check/messagebus/messagebus_client.cpp index daac8d9a99..6a42e74c25 100644 --- a/library/cpp/messagebus/rain_check/messagebus/messagebus_client.cpp +++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_client.cpp @@ -66,7 +66,7 @@ void TBusClientService::OnReply( TAutoPtr<TBusMessage> request, TAutoPtr<TBusMessage> response) { TBusFuture* future = (TBusFuture*)request->Data; - Y_ASSERT(future->Request.Get() == request.Get()); + Y_ASSERT(future->Request.Get() == request.Get()); Y_UNUSED(request.Release()); future->SetDoneAndSchedule(MESSAGE_OK, response); } @@ -74,7 +74,7 @@ void TBusClientService::OnReply( void NRainCheck::TBusClientService::OnMessageSentOneWay( TAutoPtr<NBus::TBusMessage> request) { TBusFuture* future = (TBusFuture*)request->Data; - Y_ASSERT(future->Request.Get() == request.Get()); + Y_ASSERT(future->Request.Get() == request.Get()); Y_UNUSED(request.Release()); future->SetDoneAndSchedule(MESSAGE_OK, nullptr); } @@ -86,7 +86,7 @@ void TBusClientService::OnError( } TBusFuture* future = (TBusFuture*)message->Data; - Y_ASSERT(future->Request.Get() == message.Get()); + Y_ASSERT(future->Request.Get() == message.Get()); Y_UNUSED(message.Release()); future->SetDoneAndSchedule(status, nullptr); } diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h b/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h index 0a291cdea6..6b26755083 100644 --- a/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h +++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_client.h @@ -31,12 +31,12 @@ namespace NRainCheck { } NBus::TBusMessage* GetResponse() const { - Y_ASSERT(IsDone()); + Y_ASSERT(IsDone()); return Response.Get(); } NBus::EMessageStatus GetStatus() const { - Y_ASSERT(IsDone()); + Y_ASSERT(IsDone()); return Status; } }; diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp b/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp index 1b3618558b..e0883b49b9 100644 --- a/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp +++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_client_ut.cpp @@ -32,7 +32,7 @@ struct TMessageBusClientEnv: public TTestEnvTemplate<TMessageBusClientEnv> { } }; -Y_UNIT_TEST_SUITE(RainCheckMessageBusClient) { +Y_UNIT_TEST_SUITE(RainCheckMessageBusClient) { struct TSimpleTask: public ISimpleTask { TMessageBusClientEnv* const Env; @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(RainCheckMessageBusClient) { TContinueFunc GotReplies() { for (unsigned i = 0; i < Requests.size(); ++i) { - Y_VERIFY(Requests[i]->GetStatus() == MESSAGE_OK); + Y_VERIFY(Requests[i]->GetStatus() == MESSAGE_OK); VerifyDynamicCast<TExampleResponse*>(Requests[i]->GetResponse()); } Env->TestSync.CheckAndIncrement(0); @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(RainCheckMessageBusClient) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -124,15 +124,15 @@ Y_UNIT_TEST_SUITE(RainCheckMessageBusClient) { TContinueFunc GotReplies() { for (unsigned i = 0; i < Requests.size(); ++i) { - Y_VERIFY(Requests[i]->GetStatus() == MESSAGE_OK); - Y_VERIFY(!Requests[i]->GetResponse()); + Y_VERIFY(Requests[i]->GetStatus() == MESSAGE_OK); + Y_VERIFY(!Requests[i]->GetResponse()); } Env->TestSync.WaitForAndIncrement(2); return nullptr; } }; - Y_UNIT_TEST(OneWay) { + Y_UNIT_TEST(OneWay) { TObjectCountCheck objectCountCheck; TMessageBusClientEnv env; diff --git a/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp b/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp index 7c11399f1b..af2084762f 100644 --- a/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp +++ b/library/cpp/messagebus/rain_check/messagebus/messagebus_server_ut.cpp @@ -14,7 +14,7 @@ struct TMessageBusServerEnv: public TTestEnvTemplate<TMessageBusServerEnv> { TExampleProtocol Proto; }; -Y_UNIT_TEST_SUITE(RainCheckMessageBusServer) { +Y_UNIT_TEST_SUITE(RainCheckMessageBusServer) { struct TSimpleServerTask: public ISimpleTask { private: TMessageBusServerEnv* const Env; @@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(RainCheckMessageBusServer) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TMessageBusServerEnv env; THolder<TBusTaskStarter> starter(TBusTaskStarter::NewStarter<TSimpleServerTask>(&env)); diff --git a/library/cpp/messagebus/rain_check/test/helper/misc.cpp b/library/cpp/messagebus/rain_check/test/helper/misc.cpp index c0fcb27252..e0a88a8ab9 100644 --- a/library/cpp/messagebus/rain_check/test/helper/misc.cpp +++ b/library/cpp/messagebus/rain_check/test/helper/misc.cpp @@ -5,7 +5,7 @@ using namespace NRainCheck; void TSpawnNopTasksCoroTask::Run() { - Y_VERIFY(Count <= Completion.size()); + Y_VERIFY(Count <= Completion.size()); for (unsigned i = 0; i < Count; ++i) { SpawnSubtask<TNopCoroTask>(Env, &Completion[i], ""); } @@ -14,7 +14,7 @@ void TSpawnNopTasksCoroTask::Run() { } TContinueFunc TSpawnNopTasksSimpleTask::Start() { - Y_VERIFY(Count <= Completion.size()); + Y_VERIFY(Count <= Completion.size()); for (unsigned i = 0; i < Count; ++i) { SpawnSubtask<TNopSimpleTask>(Env, &Completion[i], ""); } diff --git a/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp b/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp index 22edbd8c6b..5a353da5bb 100644 --- a/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/rain_check/test/perftest/perftest.cpp @@ -137,8 +137,8 @@ struct TReproduceCrashTask: public ISimpleTask { }; int main(int argc, char** argv) { - Y_UNUSED(argc); - Y_UNUSED(argv); + Y_UNUSED(argc); + Y_UNUSED(argv); TRainCheckPerftestEnv env; diff --git a/library/cpp/messagebus/remote_client_connection.cpp b/library/cpp/messagebus/remote_client_connection.cpp index 8c7a6db3a8..9e173706f5 100644 --- a/library/cpp/messagebus/remote_client_connection.cpp +++ b/library/cpp/messagebus/remote_client_connection.cpp @@ -20,7 +20,7 @@ TRemoteClientConnection::TRemoteClientConnection(TRemoteClientSessionPtr session : TRemoteConnection(session.Get(), id, addr) , ClientHandler(GetSession()->ClientHandler) { - Y_VERIFY(addr.GetPort() > 0, "must connect to non-zero port"); + Y_VERIFY(addr.GetPort() > 0, "must connect to non-zero port"); ScheduleWrite(); } @@ -35,7 +35,7 @@ TBusMessage* TRemoteClientConnection::PopAck(TBusKey id) { SOCKET TRemoteClientConnection::CreateSocket(const TNetAddr& addr) { SOCKET handle = socket(addr.Addr()->sa_family, SOCK_STREAM, 0); - Y_VERIFY(handle != INVALID_SOCKET, "failed to create socket: %s", LastSystemErrorText()); + Y_VERIFY(handle != INVALID_SOCKET, "failed to create socket: %s", LastSystemErrorText()); TSocketHolder s(handle); @@ -61,7 +61,7 @@ void TRemoteClientConnection::TryConnect() { if (AtomicGet(WriterData.Down)) { return; } - Y_VERIFY(!WriterData.Status.Connected); + Y_VERIFY(!WriterData.Status.Connected); TInstant now = TInstant::Now(); @@ -119,8 +119,8 @@ void TRemoteClientConnection::TryConnect() { } void TRemoteClientConnection::HandleEvent(SOCKET socket, void* cookie) { - Y_UNUSED(socket); - Y_ASSERT(cookie == WriteCookie || cookie == ReadCookie); + Y_UNUSED(socket); + Y_ASSERT(cookie == WriteCookie || cookie == ReadCookie); if (cookie == ReadCookie) { ScheduleRead(); } else { @@ -181,18 +181,18 @@ void TRemoteClientConnection::ProcessReplyQueue() { workQueueTemp.GetVector()->reserve(replyQueueTemp.GetVector()->size()); } - for (auto& resp : *replyQueueTemp.GetVector()) { - TBusMessage* req = PopAck(resp.Header.Id); + for (auto& resp : *replyQueueTemp.GetVector()) { + TBusMessage* req = PopAck(resp.Header.Id); if (!req) { - WriterErrorMessage(resp.MessagePtr.Release(), MESSAGE_UNKNOWN); + WriterErrorMessage(resp.MessagePtr.Release(), MESSAGE_UNKNOWN); continue; } if (executeInWorkerPool) { - workQueueTemp.GetVector()->push_back(new TInvokeOnReply(GetSession(), req, resp)); + workQueueTemp.GetVector()->push_back(new TInvokeOnReply(GetSession(), req, resp)); } else { - GetSession()->ReleaseInFlightAndCallOnReply(req, resp); + GetSession()->ReleaseInFlightAndCallOnReply(req, resp); } } @@ -252,11 +252,11 @@ void TRemoteClientConnection::ReaderProcessMessageUnknownVersion(TArrayRef<const LWPROBE(Error, ToString(MESSAGE_INVALID_VERSION), ToString(PeerAddr), ""); ReaderData.Status.Incremental.StatusCounter[MESSAGE_INVALID_VERSION] += 1; // TODO: close connection - Y_FAIL("unknown message"); + Y_FAIL("unknown message"); } void TRemoteClientConnection::ClearOutgoingQueue(TMessagesPtrs& result, bool reconnect) { - Y_ASSERT(result.empty()); + Y_ASSERT(result.empty()); TRemoteConnection::ClearOutgoingQueue(result, reconnect); AckMessages.Clear(&result); @@ -266,26 +266,26 @@ void TRemoteClientConnection::ClearOutgoingQueue(TMessagesPtrs& result, bool rec } void TRemoteClientConnection::MessageSent(TArrayRef<TBusMessagePtrAndHeader> messages) { - for (auto& message : messages) { - bool oneWay = message.LocalFlags & MESSAGE_ONE_WAY_INTERNAL; + for (auto& message : messages) { + bool oneWay = message.LocalFlags & MESSAGE_ONE_WAY_INTERNAL; if (oneWay) { - message.MessagePtr->LocalFlags &= ~MESSAGE_ONE_WAY_INTERNAL; + message.MessagePtr->LocalFlags &= ~MESSAGE_ONE_WAY_INTERNAL; - TBusMessage* ackMsg = this->PopAck(message.Header.Id); + TBusMessage* ackMsg = this->PopAck(message.Header.Id); if (!ackMsg) { // TODO: expired? } - if (ackMsg != message.MessagePtr.Get()) { + if (ackMsg != message.MessagePtr.Get()) { // TODO: non-unique id? } GetSession()->ReleaseInFlight({message.MessagePtr.Get()}); - ClientHandler->OnMessageSentOneWay(message.MessagePtr.Release()); + ClientHandler->OnMessageSentOneWay(message.MessagePtr.Release()); } else { - ClientHandler->OnMessageSent(message.MessagePtr.Get()); - AckMessages.Push(message); + ClientHandler->OnMessageSent(message.MessagePtr.Get()); + AckMessages.Push(message); } } } @@ -306,7 +306,7 @@ EMessageStatus TRemoteClientConnection::SendMessageImpl(TBusMessage* msg, bool w } if (wait) { - Y_VERIFY(!Session->Queue->GetExecutor()->IsInExecutorThread()); + Y_VERIFY(!Session->Queue->GetExecutor()->IsInExecutorThread()); GetSession()->ClientRemoteInFlight.Wait(); } else { if (!GetSession()->ClientRemoteInFlight.TryWait()) { diff --git a/library/cpp/messagebus/remote_client_session.cpp b/library/cpp/messagebus/remote_client_session.cpp index 3bc421944f..8fcbf6ba2d 100644 --- a/library/cpp/messagebus/remote_client_session.cpp +++ b/library/cpp/messagebus/remote_client_session.cpp @@ -34,7 +34,7 @@ void TRemoteClientSession::OnMessageReceived(TRemoteConnection* c, TVectorSwaps< } EMessageStatus TRemoteClientSession::SendMessageImpl(TBusMessage* msg, const TNetAddr* addr, bool wait, bool oneWay) { - if (Y_UNLIKELY(IsDown())) { + if (Y_UNLIKELY(IsDown())) { return MESSAGE_SHUTDOWN; } @@ -47,7 +47,7 @@ EMessageStatus TRemoteClientSession::SendMessageImpl(TBusMessage* msg, const TNe msg->ReplyTo = resolvedAddr; TRemoteConnectionPtr c = ((TBusSessionImpl*)this)->GetConnection(resolvedAddr, true); - Y_ASSERT(!!c); + Y_ASSERT(!!c); return CheckedCast<TRemoteClientConnection*>(c.Get())->SendMessageImpl(msg, wait, oneWay); } @@ -72,24 +72,24 @@ void TRemoteClientSession::FillStatus() { } void TRemoteClientSession::AcquireInFlight(TArrayRef<TBusMessage* const> messages) { - for (auto message : messages) { - Y_ASSERT(!(message->LocalFlags & MESSAGE_IN_FLIGHT_ON_CLIENT)); - message->LocalFlags |= MESSAGE_IN_FLIGHT_ON_CLIENT; + for (auto message : messages) { + Y_ASSERT(!(message->LocalFlags & MESSAGE_IN_FLIGHT_ON_CLIENT)); + message->LocalFlags |= MESSAGE_IN_FLIGHT_ON_CLIENT; } ClientRemoteInFlight.IncrementMultiple(messages.size()); } void TRemoteClientSession::ReleaseInFlight(TArrayRef<TBusMessage* const> messages) { - for (auto message : messages) { - Y_ASSERT(message->LocalFlags & MESSAGE_IN_FLIGHT_ON_CLIENT); - message->LocalFlags &= ~MESSAGE_IN_FLIGHT_ON_CLIENT; + for (auto message : messages) { + Y_ASSERT(message->LocalFlags & MESSAGE_IN_FLIGHT_ON_CLIENT); + message->LocalFlags &= ~MESSAGE_IN_FLIGHT_ON_CLIENT; } ClientRemoteInFlight.ReleaseMultiple(messages.size()); } void TRemoteClientSession::ReleaseInFlightAndCallOnReply(TNonDestroyingAutoPtr<TBusMessage> request, TBusMessagePtrAndHeader& response) { ReleaseInFlight({request.Get()}); - if (Y_UNLIKELY(AtomicGet(Down))) { + if (Y_UNLIKELY(AtomicGet(Down))) { InvokeOnError(request, MESSAGE_SHUTDOWN); InvokeOnError(response.MessagePtr.Release(), MESSAGE_SHUTDOWN); diff --git a/library/cpp/messagebus/remote_client_session_semaphore.cpp b/library/cpp/messagebus/remote_client_session_semaphore.cpp index f877ed4257..573ef402c1 100644 --- a/library/cpp/messagebus/remote_client_session_semaphore.cpp +++ b/library/cpp/messagebus/remote_client_session_semaphore.cpp @@ -12,12 +12,12 @@ TRemoteClientSessionSemaphore::TRemoteClientSessionSemaphore(TAtomicBase limit, , Current(0) , StopSignal(0) { - Y_VERIFY(limit > 0, "limit must be > 0"); - Y_UNUSED(Name); + Y_VERIFY(limit > 0, "limit must be > 0"); + Y_UNUSED(Name); } TRemoteClientSessionSemaphore::~TRemoteClientSessionSemaphore() { - Y_VERIFY(AtomicGet(Current) == 0); + Y_VERIFY(AtomicGet(Current) == 0); } bool TRemoteClientSessionSemaphore::TryAcquire() { @@ -32,7 +32,7 @@ bool TRemoteClientSessionSemaphore::TryAcquire() { bool TRemoteClientSessionSemaphore::TryWait() { if (AtomicGet(Current) < Limit) return true; - if (Y_UNLIKELY(AtomicGet(StopSignal))) + if (Y_UNLIKELY(AtomicGet(StopSignal))) return true; return false; } diff --git a/library/cpp/messagebus/remote_connection_status.cpp b/library/cpp/messagebus/remote_connection_status.cpp index 2c48b2a287..34d7973df7 100644 --- a/library/cpp/messagebus/remote_connection_status.cpp +++ b/library/cpp/messagebus/remote_connection_status.cpp @@ -25,8 +25,8 @@ static void Max(T& thiz, const T& that) { template <typename T> static void AssertZero(T& thiz, const T& that) { - Y_ASSERT(thiz == T()); - Y_UNUSED(that); + Y_ASSERT(thiz == T()); + Y_UNUSED(that); } TDurationCounter::TDurationCounter() diff --git a/library/cpp/messagebus/remote_server_connection.cpp b/library/cpp/messagebus/remote_server_connection.cpp index 74be34ded9..d98653f06a 100644 --- a/library/cpp/messagebus/remote_server_connection.cpp +++ b/library/cpp/messagebus/remote_server_connection.cpp @@ -19,7 +19,7 @@ void TRemoteServerConnection::Init(SOCKET socket, TInstant now) { WriterData.Status.ConnectTime = now; WriterData.Status.Connected = true; - Y_VERIFY(socket != INVALID_SOCKET, "must be a valid socket"); + Y_VERIFY(socket != INVALID_SOCKET, "must be a valid socket"); TSocket readSocket(socket); TSocket writeSocket = readSocket; @@ -37,8 +37,8 @@ TRemoteServerSession* TRemoteServerConnection::GetSession() { } void TRemoteServerConnection::HandleEvent(SOCKET socket, void* cookie) { - Y_UNUSED(socket); - Y_ASSERT(cookie == ReadCookie || cookie == WriteCookie); + Y_UNUSED(socket); + Y_ASSERT(cookie == ReadCookie || cookie == WriteCookie); if (cookie == ReadCookie) { GetSession()->ServerOwnedMessages.Wait(); ScheduleRead(); @@ -55,9 +55,9 @@ void TRemoteServerConnection::MessageSent(TArrayRef<TBusMessagePtrAndHeader> mes TInstant now = TInstant::Now(); GetSession()->ReleaseInWorkResponses(messages); - for (auto& message : messages) { - TInstant recvTime = message.MessagePtr->RecvTime; - GetSession()->ServerHandler->OnSent(message.MessagePtr.Release()); + for (auto& message : messages) { + TInstant recvTime = message.MessagePtr->RecvTime; + GetSession()->ServerHandler->OnSent(message.MessagePtr.Release()); TDuration d = now - recvTime; WriterData.Status.DurationCounter.AddDuration(d); WriterData.Status.Incremental.ProcessDurationHistogram.AddTime(d); diff --git a/library/cpp/messagebus/remote_server_session.cpp b/library/cpp/messagebus/remote_server_session.cpp index 6abbf88a60..12f5408ea9 100644 --- a/library/cpp/messagebus/remote_server_session.cpp +++ b/library/cpp/messagebus/remote_server_session.cpp @@ -69,13 +69,13 @@ void TRemoteServerSession::OnMessageReceived(TRemoteConnection* c, TVectorSwaps< workQueueTemp.GetVector()->reserve(messages.size()); } - for (auto& message : messages) { + for (auto& message : messages) { // TODO: incref once TIntrusivePtr<TRemoteServerConnection> connection(CheckedCast<TRemoteServerConnection*>(c)); if (executeInPool) { - workQueueTemp.GetVector()->push_back(new TInvokeOnMessage(this, message, connection)); + workQueueTemp.GetVector()->push_back(new TInvokeOnMessage(this, message, connection)); } else { - InvokeOnMessage(message, connection); + InvokeOnMessage(message, connection); } } @@ -86,7 +86,7 @@ void TRemoteServerSession::OnMessageReceived(TRemoteConnection* c, TVectorSwaps< } void TRemoteServerSession::InvokeOnMessage(TBusMessagePtrAndHeader& request, TIntrusivePtr<TRemoteServerConnection>& conn) { - if (Y_UNLIKELY(AtomicGet(Down))) { + if (Y_UNLIKELY(AtomicGet(Down))) { ReleaseInWorkRequests(*conn.Get(), request.MessagePtr.Get()); InvokeOnError(request.MessagePtr.Release(), MESSAGE_SHUTDOWN); } else { @@ -97,7 +97,7 @@ void TRemoteServerSession::InvokeOnMessage(TBusMessagePtrAndHeader& request, TIn ident.Connection.Swap(conn); request.MessagePtr->GetIdentity(ident); - Y_ASSERT(request.MessagePtr->LocalFlags & MESSAGE_IN_WORK); + Y_ASSERT(request.MessagePtr->LocalFlags & MESSAGE_IN_WORK); DoSwap(request.MessagePtr->LocalFlags, ident.LocalFlags); ident.RecvTime = request.MessagePtr->RecvTime; @@ -146,7 +146,7 @@ void TRemoteServerSession::FillStatus() { void TRemoteServerSession::AcquireInWorkRequests(TArrayRef<const TBusMessagePtrAndHeader> messages) { TAtomicBase size = 0; for (auto message = messages.begin(); message != messages.end(); ++message) { - Y_ASSERT(!(message->MessagePtr->LocalFlags & MESSAGE_IN_WORK)); + Y_ASSERT(!(message->MessagePtr->LocalFlags & MESSAGE_IN_WORK)); message->MessagePtr->LocalFlags |= MESSAGE_IN_WORK; size += message->MessagePtr->GetHeader()->Size; } @@ -157,7 +157,7 @@ void TRemoteServerSession::AcquireInWorkRequests(TArrayRef<const TBusMessagePtrA void TRemoteServerSession::ReleaseInWorkResponses(TArrayRef<const TBusMessagePtrAndHeader> responses) { TAtomicBase size = 0; for (auto response = responses.begin(); response != responses.end(); ++response) { - Y_ASSERT((response->MessagePtr->LocalFlags & MESSAGE_REPLY_IS_BEGING_SENT)); + Y_ASSERT((response->MessagePtr->LocalFlags & MESSAGE_REPLY_IS_BEGING_SENT)); response->MessagePtr->LocalFlags &= ~MESSAGE_REPLY_IS_BEGING_SENT; size += response->MessagePtr->RequestSize; } @@ -166,7 +166,7 @@ void TRemoteServerSession::ReleaseInWorkResponses(TArrayRef<const TBusMessagePtr } void TRemoteServerSession::ReleaseInWorkRequests(TRemoteConnection& con, TBusMessage* request) { - Y_ASSERT((request->LocalFlags & MESSAGE_IN_WORK)); + Y_ASSERT((request->LocalFlags & MESSAGE_IN_WORK)); request->LocalFlags &= ~MESSAGE_IN_WORK; const size_t size = request->GetHeader()->Size; @@ -186,7 +186,7 @@ void TRemoteServerSession::ConvertInWork(TBusIdentity& req, TBusMessage* reply) reply->SetIdentity(req); req.SetInWork(false); - Y_ASSERT(!(reply->LocalFlags & MESSAGE_REPLY_IS_BEGING_SENT)); + Y_ASSERT(!(reply->LocalFlags & MESSAGE_REPLY_IS_BEGING_SENT)); reply->LocalFlags |= MESSAGE_REPLY_IS_BEGING_SENT; reply->RequestSize = req.Size; } @@ -201,6 +201,6 @@ void TRemoteServerSession::PauseInput(bool pause) { } unsigned TRemoteServerSession::GetActualListenPort() { - Y_VERIFY(Config.ListenPort > 0, "state check"); + Y_VERIFY(Config.ListenPort > 0, "state check"); return Config.ListenPort; } diff --git a/library/cpp/messagebus/remote_server_session_semaphore.cpp b/library/cpp/messagebus/remote_server_session_semaphore.cpp index 6094a3586e..1d074dbcb7 100644 --- a/library/cpp/messagebus/remote_server_session_semaphore.cpp +++ b/library/cpp/messagebus/remote_server_session_semaphore.cpp @@ -16,18 +16,18 @@ TRemoteServerSessionSemaphore::TRemoteServerSessionSemaphore( , PausedByUser(0) , StopSignal(0) { - Y_VERIFY(limitCount > 0, "limit must be > 0"); - Y_UNUSED(Name); + Y_VERIFY(limitCount > 0, "limit must be > 0"); + Y_UNUSED(Name); } TRemoteServerSessionSemaphore::~TRemoteServerSessionSemaphore() { - Y_VERIFY(AtomicGet(CurrentCount) == 0); + Y_VERIFY(AtomicGet(CurrentCount) == 0); // TODO: fix spider and enable - //Y_VERIFY(AtomicGet(CurrentSize) == 0); + //Y_VERIFY(AtomicGet(CurrentSize) == 0); } bool TRemoteServerSessionSemaphore::TryWait() { - if (Y_UNLIKELY(AtomicGet(StopSignal))) + if (Y_UNLIKELY(AtomicGet(StopSignal))) return true; if (AtomicGet(PausedByUser)) return false; diff --git a/library/cpp/messagebus/scheduler/scheduler.cpp b/library/cpp/messagebus/scheduler/scheduler.cpp index 5a5fe52894..506af354e6 100644 --- a/library/cpp/messagebus/scheduler/scheduler.cpp +++ b/library/cpp/messagebus/scheduler/scheduler.cpp @@ -23,7 +23,7 @@ TScheduler::TScheduler() } TScheduler::~TScheduler() { - Y_VERIFY(StopThread, "state check"); + Y_VERIFY(StopThread, "state check"); } size_t TScheduler::Size() const { @@ -34,7 +34,7 @@ size_t TScheduler::Size() const { void TScheduler::Stop() { { TGuard<TLock> guard(Lock); - Y_VERIFY(!StopThread, "Scheduler already stopped"); + Y_VERIFY(!StopThread, "Scheduler already stopped"); StopThread = true; CondVar.Signal(); } @@ -44,8 +44,8 @@ void TScheduler::Stop() { NextItem.Destroy(); } - for (auto& item : Items) { - item.Destroy(); + for (auto& item : Items) { + item.Destroy(); } } @@ -98,7 +98,7 @@ void TScheduler::SchedulerThread() { } // signal comes if either scheduler is to be stopped of there's work to do - Y_VERIFY(!!NextItem, "state check"); + Y_VERIFY(!!NextItem, "state check"); if (TInstant::Now() < NextItem->GetScheduleTime()) { // NextItem is updated since WaitD diff --git a/library/cpp/messagebus/scheduler/scheduler_ut.cpp b/library/cpp/messagebus/scheduler/scheduler_ut.cpp index a5ea641c10..afe89e9263 100644 --- a/library/cpp/messagebus/scheduler/scheduler_ut.cpp +++ b/library/cpp/messagebus/scheduler/scheduler_ut.cpp @@ -7,7 +7,7 @@ using namespace NBus; using namespace NBus::NPrivate; -Y_UNIT_TEST_SUITE(TSchedulerTests) { +Y_UNIT_TEST_SUITE(TSchedulerTests) { struct TSimpleScheduleItem: public IScheduleItem { TTestSync* const TestSync; @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TSchedulerTests) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TTestSync testSync; TScheduler scheduler; diff --git a/library/cpp/messagebus/scheduler_actor_ut.cpp b/library/cpp/messagebus/scheduler_actor_ut.cpp index e81ffd3186..c885e40f59 100644 --- a/library/cpp/messagebus/scheduler_actor_ut.cpp +++ b/library/cpp/messagebus/scheduler_actor_ut.cpp @@ -7,7 +7,7 @@ using namespace NBus; using namespace NBus::NPrivate; using namespace NActor; -Y_UNIT_TEST_SUITE(TSchedulerActorTests) { +Y_UNIT_TEST_SUITE(TSchedulerActorTests) { struct TMyActor: public TAtomicRefCount<TMyActor>, public TActor<TMyActor>, public TScheduleActor<TMyActor> { TTestSync TestSync; @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TSchedulerActorTests) { void Act(TDefaultTag) { if (!Alarm.FetchTask()) { - Y_FAIL("must not have no spurious wakeups in test"); + Y_FAIL("must not have no spurious wakeups in test"); } TestSync.WaitForAndIncrement(Iteration++); @@ -32,7 +32,7 @@ Y_UNIT_TEST_SUITE(TSchedulerActorTests) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TExecutor executor(1); TScheduler scheduler; diff --git a/library/cpp/messagebus/session_impl.cpp b/library/cpp/messagebus/session_impl.cpp index ddf9f360c4..1552ee775f 100644 --- a/library/cpp/messagebus/session_impl.cpp +++ b/library/cpp/messagebus/session_impl.cpp @@ -58,28 +58,28 @@ namespace { copy.TotalTimeout = TDuration::Seconds(60).MilliSeconds(); copy.SendTimeout = TDuration::Seconds(15).MilliSeconds(); } else if (copy.TotalTimeout == 0) { - Y_ASSERT(copy.SendTimeout != 0); + Y_ASSERT(copy.SendTimeout != 0); copy.TotalTimeout = config.SendTimeout + TDuration::MilliSeconds(10).MilliSeconds(); } else if (copy.SendTimeout == 0) { - Y_ASSERT(copy.TotalTimeout != 0); + Y_ASSERT(copy.TotalTimeout != 0); if ((ui64)copy.TotalTimeout > (ui64)TDuration::MilliSeconds(10).MilliSeconds()) { copy.SendTimeout = copy.TotalTimeout - TDuration::MilliSeconds(10).MilliSeconds(); } else { copy.SendTimeout = copy.TotalTimeout; } } else { - Y_ASSERT(copy.TotalTimeout != 0); - Y_ASSERT(copy.SendTimeout != 0); + Y_ASSERT(copy.TotalTimeout != 0); + Y_ASSERT(copy.SendTimeout != 0); } if (copy.ConnectTimeout == 0) { copy.ConnectTimeout = copy.SendTimeout; } - Y_VERIFY(copy.SendTimeout > 0, "SendTimeout must be > 0"); - Y_VERIFY(copy.TotalTimeout > 0, "TotalTimeout must be > 0"); - Y_VERIFY(copy.ConnectTimeout > 0, "ConnectTimeout must be > 0"); - Y_VERIFY(copy.TotalTimeout >= copy.SendTimeout, "TotalTimeout must be >= SendTimeout"); + Y_VERIFY(copy.SendTimeout > 0, "SendTimeout must be > 0"); + Y_VERIFY(copy.TotalTimeout > 0, "TotalTimeout must be > 0"); + Y_VERIFY(copy.ConnectTimeout > 0, "ConnectTimeout must be > 0"); + Y_VERIFY(copy.TotalTimeout >= copy.SendTimeout, "TotalTimeout must be >= SendTimeout"); if (!copy.Name) { copy.Name = name; @@ -117,10 +117,10 @@ TBusSessionImpl::TBusSessionImpl(bool isSource, TBusMessageQueue* queue, TBusPro } TBusSessionImpl::~TBusSessionImpl() { - Y_VERIFY(Down); - Y_VERIFY(ShutdownCompleteEvent.WaitT(TDuration::Zero())); - Y_VERIFY(!WriteEventLoop.IsRunning()); - Y_VERIFY(!ReadEventLoop.IsRunning()); + Y_VERIFY(Down); + Y_VERIFY(ShutdownCompleteEvent.WaitT(TDuration::Zero())); + Y_VERIFY(!WriteEventLoop.IsRunning()); + Y_VERIFY(!ReadEventLoop.IsRunning()); } TBusSessionStatus::TBusSessionStatus() @@ -136,7 +136,7 @@ void TBusSessionImpl::Shutdown() { return; } - Y_VERIFY(Queue->IsRunning(), "Session must be shut down prior to queue shutdown"); + Y_VERIFY(Queue->IsRunning(), "Session must be shut down prior to queue shutdown"); TUseAfterFreeCheckerGuard handlerAliveCheckedGuard(ErrorHandler->UseAfterFreeChecker); @@ -161,16 +161,16 @@ void TBusSessionImpl::Shutdown() { Acceptors.clear(); } - for (auto& acceptor : acceptors) { - acceptor->Shutdown(); + for (auto& acceptor : acceptors) { + acceptor->Shutdown(); } // shutdown connections TVector<TRemoteConnectionPtr> cs; GetConnections(&cs); - for (auto& c : cs) { - c->Shutdown(MESSAGE_SHUTDOWN); + for (auto& c : cs) { + c->Shutdown(MESSAGE_SHUTDOWN); } // shutdown connections actor @@ -205,7 +205,7 @@ size_t TBusSessionImpl::GetInFlightImpl(const TNetAddr& addr) const { } void TBusSessionImpl::GetInFlightBulk(TArrayRef<const TNetAddr> addrs, TArrayRef<size_t> results) const { - Y_VERIFY(addrs.size() == results.size(), "input.size != output.size"); + Y_VERIFY(addrs.size() == results.size(), "input.size != output.size"); for (size_t i = 0; i < addrs.size(); ++i) { results[i] = GetInFlightImpl(addrs[i]); } @@ -221,7 +221,7 @@ size_t TBusSessionImpl::GetConnectSyscallsNumForTestImpl(const TNetAddr& addr) c } void TBusSessionImpl::GetConnectSyscallsNumBulkForTest(TArrayRef<const TNetAddr> addrs, TArrayRef<size_t> results) const { - Y_VERIFY(addrs.size() == results.size(), "input.size != output.size"); + Y_VERIFY(addrs.size() == results.size(), "input.size != output.size"); for (size_t i = 0; i < addrs.size(); ++i) { results[i] = GetConnectSyscallsNumForTestImpl(addrs[i]); } @@ -232,7 +232,7 @@ void TBusSessionImpl::FillStatus() { TSessionDumpStatus TBusSessionImpl::GetStatusRecordInternal() { // Probably useless, because it returns cached info now - Y_VERIFY(!Queue->GetExecutor()->IsInExecutorThread(), + Y_VERIFY(!Queue->GetExecutor()->IsInExecutorThread(), "GetStatus must not be called from executor thread"); TGuard<TMutex> guard(StatusData.StatusDumpCachedMutex); @@ -242,13 +242,13 @@ TSessionDumpStatus TBusSessionImpl::GetStatusRecordInternal() { } TString TBusSessionImpl::GetStatus(ui16 flags) { - Y_UNUSED(flags); + Y_UNUSED(flags); return GetStatusRecordInternal().PrintToString(); } TConnectionStatusMonRecord TBusSessionImpl::GetStatusProtobuf() { - Y_VERIFY(!Queue->GetExecutor()->IsInExecutorThread(), + Y_VERIFY(!Queue->GetExecutor()->IsInExecutorThread(), "GetStatus must not be called from executor thread"); TGuard<TMutex> guard(StatusData.StatusDumpCachedMutex); @@ -319,12 +319,12 @@ void TBusSessionImpl::ProcessItem(TConnectionTag, TRemoveTag, TRemoteConnectionP void TBusSessionImpl::ProcessConnectionsAcceptorsShapshotQueueItem(TAtomicSharedPtr<TConnectionsAcceptorsSnapshot> snapshot) { for (TVector<TRemoteConnectionPtr>::const_iterator connection = snapshot->Connections.begin(); connection != snapshot->Connections.end(); ++connection) { - Y_ASSERT((*connection)->ConnectionId <= snapshot->LastConnectionId); + Y_ASSERT((*connection)->ConnectionId <= snapshot->LastConnectionId); } for (TVector<TAcceptorPtr>::const_iterator acceptor = snapshot->Acceptors.begin(); acceptor != snapshot->Acceptors.end(); ++acceptor) { - Y_ASSERT((*acceptor)->AcceptorId <= snapshot->LastAcceptorId); + Y_ASSERT((*acceptor)->AcceptorId <= snapshot->LastAcceptorId); } StatusData.ConnectionsAcceptorsSnapshot = snapshot; @@ -471,8 +471,8 @@ void TBusSessionImpl::Act(TConnectionTag) { EShutdownState shutdownState = ConnectionsData.ShutdownState.State.Get(); if (shutdownState == SS_SHUTDOWN_COMPLETE) { - Y_VERIFY(GetRemoveConnectionQueue()->IsEmpty()); - Y_VERIFY(GetOnAcceptQueue()->IsEmpty()); + Y_VERIFY(GetRemoveConnectionQueue()->IsEmpty()); + Y_VERIFY(GetOnAcceptQueue()->IsEmpty()); } GetRemoveConnectionQueue()->DequeueAllLikelyEmpty(); @@ -488,7 +488,7 @@ void TBusSessionImpl::Listen(int port, TBusMessageQueue* q) { } void TBusSessionImpl::Listen(const TVector<TBindResult>& bindTo, TBusMessageQueue* q) { - Y_ASSERT(q == Queue); + Y_ASSERT(q == Queue); int actualPort = -1; for (const TBindResult& br : bindTo) { @@ -511,7 +511,7 @@ void TBusSessionImpl::Listen(const TVector<TBindResult>& bindTo, TBusMessageQueu } void TBusSessionImpl::SendSnapshotToStatusActor() { - //Y_ASSERT(ConnectionsLock.IsLocked()); + //Y_ASSERT(ConnectionsLock.IsLocked()); TAtomicSharedPtr<TConnectionsAcceptorsSnapshot> snapshot(new TConnectionsAcceptorsSnapshot); GetAcceptorsLockAquired(&snapshot->Acceptors); @@ -523,7 +523,7 @@ void TBusSessionImpl::SendSnapshotToStatusActor() { } void TBusSessionImpl::InsertConnectionLockAcquired(TRemoteConnection* connection) { - //Y_ASSERT(ConnectionsLock.IsLocked()); + //Y_ASSERT(ConnectionsLock.IsLocked()); Connections.insert(std::make_pair(connection->PeerAddrSocketAddr, connection)); // connection for given adds may already exist at this point @@ -531,13 +531,13 @@ void TBusSessionImpl::InsertConnectionLockAcquired(TRemoteConnection* connection // after reconnect, if previous connections wasn't shutdown yet bool inserted2 = ConnectionsById.insert(std::make_pair(connection->ConnectionId, connection)).second; - Y_VERIFY(inserted2, "state check: must be inserted (2)"); + Y_VERIFY(inserted2, "state check: must be inserted (2)"); SendSnapshotToStatusActor(); } void TBusSessionImpl::InsertAcceptorLockAcquired(TAcceptor* acceptor) { - //Y_ASSERT(ConnectionsLock.IsLocked()); + //Y_ASSERT(ConnectionsLock.IsLocked()); Acceptors.push_back(acceptor); @@ -555,22 +555,22 @@ void TBusSessionImpl::GetAcceptors(TVector<TAcceptorPtr>* r) { } void TBusSessionImpl::GetConnectionsLockAquired(TVector<TRemoteConnectionPtr>* r) { - //Y_ASSERT(ConnectionsLock.IsLocked()); + //Y_ASSERT(ConnectionsLock.IsLocked()); r->reserve(Connections.size()); - for (auto& connection : Connections) { - r->push_back(connection.second); + for (auto& connection : Connections) { + r->push_back(connection.second); } } void TBusSessionImpl::GetAcceptorsLockAquired(TVector<TAcceptorPtr>* r) { - //Y_ASSERT(ConnectionsLock.IsLocked()); + //Y_ASSERT(ConnectionsLock.IsLocked()); r->reserve(Acceptors.size()); - for (auto& acceptor : Acceptors) { - r->push_back(acceptor); + for (auto& acceptor : Acceptors) { + r->push_back(acceptor); } } @@ -588,9 +588,9 @@ TRemoteConnectionPtr TBusSessionImpl::GetConnectionById(ui64 id) { TAcceptorPtr TBusSessionImpl::GetAcceptorById(ui64 id) { TGuard<TMutex> guard(ConnectionsLock); - for (const auto& Acceptor : Acceptors) { - if (Acceptor->AcceptorId == id) { - return Acceptor; + for (const auto& Acceptor : Acceptors) { + if (Acceptor->AcceptorId == id) { + return Acceptor; } } @@ -614,7 +614,7 @@ TRemoteConnectionPtr TBusSessionImpl::GetConnection(const TBusSocketAddr& addr, return TRemoteConnectionPtr(); } - Y_VERIFY(IsSource_, "must be source"); + Y_VERIFY(IsSource_, "must be source"); TRemoteConnectionPtr c(new TRemoteClientConnection(VerifyDynamicCast<TRemoteClientSession*>(this), ++LastConnectionId, addr.ToNetAddr())); InsertConnectionLockAcquired(c.Get()); @@ -626,8 +626,8 @@ void TBusSessionImpl::Cron() { TVector<TRemoteConnectionPtr> connections; GetConnections(&connections); - for (const auto& it : connections) { - TRemoteConnection* connection = it.Get(); + for (const auto& it : connections) { + TRemoteConnection* connection = it.Get(); if (IsSource_) { VerifyDynamicCast<TRemoteClientConnection*>(connection)->ScheduleTimeoutMessages(); } else { diff --git a/library/cpp/messagebus/session_job_count.cpp b/library/cpp/messagebus/session_job_count.cpp index 33322b1910..525bb1b1ef 100644 --- a/library/cpp/messagebus/session_job_count.cpp +++ b/library/cpp/messagebus/session_job_count.cpp @@ -11,7 +11,7 @@ TBusSessionJobCount::TBusSessionJobCount() } TBusSessionJobCount::~TBusSessionJobCount() { - Y_VERIFY(JobCount == 0, "must be 0 job count to destroy job"); + Y_VERIFY(JobCount == 0, "must be 0 job count to destroy job"); } void TBusSessionJobCount::WaitForZero() { diff --git a/library/cpp/messagebus/shutdown_state.cpp b/library/cpp/messagebus/shutdown_state.cpp index a4e2bfa8b2..ce206a9772 100644 --- a/library/cpp/messagebus/shutdown_state.cpp +++ b/library/cpp/messagebus/shutdown_state.cpp @@ -3,11 +3,11 @@ #include <util/system/yassert.h> void TAtomicShutdownState::ShutdownCommand() { - Y_VERIFY(State.CompareAndSet(SS_RUNNING, SS_SHUTDOWN_COMMAND)); + Y_VERIFY(State.CompareAndSet(SS_RUNNING, SS_SHUTDOWN_COMMAND)); } void TAtomicShutdownState::CompleteShutdown() { - Y_VERIFY(State.CompareAndSet(SS_SHUTDOWN_COMMAND, SS_SHUTDOWN_COMPLETE)); + Y_VERIFY(State.CompareAndSet(SS_SHUTDOWN_COMMAND, SS_SHUTDOWN_COMPLETE)); ShutdownComplete.Signal(); } @@ -16,5 +16,5 @@ bool TAtomicShutdownState::IsRunning() { } TAtomicShutdownState::~TAtomicShutdownState() { - Y_VERIFY(SS_SHUTDOWN_COMPLETE == State.Get()); + Y_VERIFY(SS_SHUTDOWN_COMPLETE == State.Get()); } diff --git a/library/cpp/messagebus/socket_addr.cpp b/library/cpp/messagebus/socket_addr.cpp index c1b3a28fbe..2e88494920 100644 --- a/library/cpp/messagebus/socket_addr.cpp +++ b/library/cpp/messagebus/socket_addr.cpp @@ -74,6 +74,6 @@ TNetAddr NBus::NPrivate::TBusSocketAddr::ToNetAddr() const { } template <> -void Out<TBusSocketAddr>(IOutputStream& out, const TBusSocketAddr& addr) { +void Out<TBusSocketAddr>(IOutputStream& out, const TBusSocketAddr& addr) { out << addr.ToNetAddr(); } diff --git a/library/cpp/messagebus/socket_addr_ut.cpp b/library/cpp/messagebus/socket_addr_ut.cpp index 783bb62a86..3f90d8d775 100644 --- a/library/cpp/messagebus/socket_addr_ut.cpp +++ b/library/cpp/messagebus/socket_addr_ut.cpp @@ -8,8 +8,8 @@ using namespace NBus; using namespace NBus::NPrivate; -Y_UNIT_TEST_SUITE(TBusSocketAddr) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TBusSocketAddr) { + Y_UNIT_TEST(Simple) { UNIT_ASSERT_VALUES_EQUAL(TString("127.0.0.1:80"), ToString(TBusSocketAddr("127.0.0.1", 80))); } } diff --git a/library/cpp/messagebus/synchandler.cpp b/library/cpp/messagebus/synchandler.cpp index 8e891d66b3..5ae9adc39c 100644 --- a/library/cpp/messagebus/synchandler.cpp +++ b/library/cpp/messagebus/synchandler.cpp @@ -58,12 +58,12 @@ public: } void OnMessageSent(TBusMessage* pMessage) override { - Y_UNUSED(pMessage); - Y_ASSERT(ExpectReply); + Y_UNUSED(pMessage); + Y_ASSERT(ExpectReply); } void OnMessageSentOneWay(TAutoPtr<TBusMessage> pMessage) override { - Y_ASSERT(!ExpectReply); + Y_ASSERT(!ExpectReply); TBusSyncMessageData* data = static_cast<TBusSyncMessageData*>(pMessage.Release()->Data); SignalResult(data, /*pReply=*/nullptr, MESSAGE_OK); } @@ -76,7 +76,7 @@ public: private: void SignalResult(TBusSyncMessageData* data, TBusMessage* pReply, EMessageStatus status) const { - Y_VERIFY(data, "Message data is set to NULL."); + Y_VERIFY(data, "Message data is set to NULL."); TGuard<TMutex> G(data->ReplyLock); data->Reply = pReply; data->ReplyStatus = status; diff --git a/library/cpp/messagebus/test/example/client/client.cpp b/library/cpp/messagebus/test/example/client/client.cpp index 89b5f2c9be..5e18fd8990 100644 --- a/library/cpp/messagebus/test/example/client/client.cpp +++ b/library/cpp/messagebus/test/example/client/client.cpp @@ -23,7 +23,7 @@ namespace NCalculator { } void OnReply(TAutoPtr<TBusMessage> request, TAutoPtr<TBusMessage> response0) override { - Y_VERIFY(response0->GetHeader()->Type == TResponse::MessageType, "wrong response"); + Y_VERIFY(response0->GetHeader()->Type == TResponse::MessageType, "wrong response"); TResponse* response = VerifyDynamicCast<TResponse*>(response0.Get()); if (request->GetHeader()->Type == TRequestSum::MessageType) { TRequestSum* requestSum = VerifyDynamicCast<TRequestSum*>(request.Get()); @@ -36,7 +36,7 @@ namespace NCalculator { int b = requestMul->Record.GetB(); Cerr << a << " * " << b << " = " << response->Record.GetResult() << "\n"; } else { - Y_FAIL("unknown request"); + Y_FAIL("unknown request"); } } diff --git a/library/cpp/messagebus/test/example/server/server.cpp b/library/cpp/messagebus/test/example/server/server.cpp index 13e52d75f5..27d427491b 100644 --- a/library/cpp/messagebus/test/example/server/server.cpp +++ b/library/cpp/messagebus/test/example/server/server.cpp @@ -39,7 +39,7 @@ namespace NCalculator { response->Record.SetResult(result); request.SendReplyMove(response); } else { - Y_FAIL("unknown request"); + Y_FAIL("unknown request"); } } }; diff --git a/library/cpp/messagebus/test/helper/alloc_counter.h b/library/cpp/messagebus/test/helper/alloc_counter.h index ec9041cb15..0f7631166b 100644 --- a/library/cpp/messagebus/test/helper/alloc_counter.h +++ b/library/cpp/messagebus/test/helper/alloc_counter.h @@ -16,6 +16,6 @@ public: } ~TAllocCounter() { - Y_VERIFY(AtomicDecrement(*CountPtr) >= 0, "released too many"); + Y_VERIFY(AtomicDecrement(*CountPtr) >= 0, "released too many"); } }; diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp index 7c6d704042..07b8e47c74 100644 --- a/library/cpp/messagebus/test/helper/example.cpp +++ b/library/cpp/messagebus/test/helper/example.cpp @@ -68,11 +68,11 @@ TExampleProtocol::~TExampleProtocol() { // so it could be reported in test return; } - Y_VERIFY(0 == AtomicGet(RequestCount), "protocol %s: must be 0 requests allocated, actually %d", GetService(), int(RequestCount)); - Y_VERIFY(0 == AtomicGet(ResponseCount), "protocol %s: must be 0 responses allocated, actually %d", GetService(), int(ResponseCount)); - Y_VERIFY(0 == AtomicGet(RequestCountDeserialized), "protocol %s: must be 0 requests deserialized allocated, actually %d", GetService(), int(RequestCountDeserialized)); - Y_VERIFY(0 == AtomicGet(ResponseCountDeserialized), "protocol %s: must be 0 responses deserialized allocated, actually %d", GetService(), int(ResponseCountDeserialized)); - Y_VERIFY(0 == AtomicGet(StartCount), "protocol %s: must be 0 start objects allocated, actually %d", GetService(), int(StartCount)); + Y_VERIFY(0 == AtomicGet(RequestCount), "protocol %s: must be 0 requests allocated, actually %d", GetService(), int(RequestCount)); + Y_VERIFY(0 == AtomicGet(ResponseCount), "protocol %s: must be 0 responses allocated, actually %d", GetService(), int(ResponseCount)); + Y_VERIFY(0 == AtomicGet(RequestCountDeserialized), "protocol %s: must be 0 requests deserialized allocated, actually %d", GetService(), int(RequestCountDeserialized)); + Y_VERIFY(0 == AtomicGet(ResponseCountDeserialized), "protocol %s: must be 0 responses deserialized allocated, actually %d", GetService(), int(ResponseCountDeserialized)); + Y_VERIFY(0 == AtomicGet(StartCount), "protocol %s: must be 0 start objects allocated, actually %d", GetService(), int(StartCount)); } void TExampleProtocol::Serialize(const TBusMessage* message, TBuffer& buffer) { @@ -83,13 +83,13 @@ void TExampleProtocol::Serialize(const TBusMessage* message, TBuffer& buffer) { } else if (const TExampleResponse* exampleReply = dynamic_cast<const TExampleResponse*>(message)) { buffer.Append(exampleReply->Data.data(), exampleReply->Data.size()); } else { - Y_FAIL("unknown message type"); + Y_FAIL("unknown message type"); } } TAutoPtr<TBusMessage> TExampleProtocol::Deserialize(ui16 messageType, TArrayRef<const char> payload) { // TODO: check data - Y_UNUSED(payload); + Y_UNUSED(payload); if (messageType == 77) { TExampleRequest* exampleMessage = new TExampleRequest(MESSAGE_CREATE_UNINITIALIZED, &RequestCountDeserialized); @@ -194,8 +194,8 @@ void TExampleClient::SendMessagesWaitReplies(size_t count, const TNetAddr& addr) } void TExampleClient::OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) { - Y_UNUSED(mess); - Y_UNUSED(reply); + Y_UNUSED(mess); + Y_UNUSED(reply); if (AtomicIncrement(RepliesCount) == MessageCount) { WorkDone.Signal(); @@ -204,10 +204,10 @@ void TExampleClient::OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> r void TExampleClient::OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) { if (CrashOnError) { - Y_FAIL("client failed: %s", ToCString(status)); + Y_FAIL("client failed: %s", ToCString(status)); } - Y_UNUSED(mess); + Y_UNUSED(mess); AtomicIncrement(Errors); LastError = status; diff --git a/library/cpp/messagebus/test/helper/message_handler_error.cpp b/library/cpp/messagebus/test/helper/message_handler_error.cpp index c09811ec67..421e0ce397 100644 --- a/library/cpp/messagebus/test/helper/message_handler_error.cpp +++ b/library/cpp/messagebus/test/helper/message_handler_error.cpp @@ -10,11 +10,11 @@ void TBusClientHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus statu } void TBusClientHandlerError::OnReply(TAutoPtr<TBusMessage>, TAutoPtr<TBusMessage>) { - Y_FAIL("must not be called"); + Y_FAIL("must not be called"); } void TBusClientHandlerError::OnMessageSentOneWay(TAutoPtr<TBusMessage>) { - Y_FAIL("must not be called"); + Y_FAIL("must not be called"); } void TBusServerHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus status) { @@ -22,5 +22,5 @@ void TBusServerHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus statu } void TBusServerHandlerError::OnMessage(TOnMessageContext&) { - Y_FAIL("must not be called"); + Y_FAIL("must not be called"); } diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 8489319278..de1ee427a2 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -150,7 +150,7 @@ TAutoPtr<TBusMessage> NewRequest() { void CheckRequest(TPerftestRequest* request) { const TString& data = request->Record.GetData(); for (size_t i = 0; i != data.size(); ++i) { - Y_VERIFY(data.at(i) == '?', "must be question mark"); + Y_VERIFY(data.at(i) == '?', "must be question mark"); } } @@ -164,7 +164,7 @@ TAutoPtr<TPerftestResponse> NewResponse(TPerftestRequest* request) { void CheckResponse(TPerftestResponse* response) { const TString& data = response->Record.GetData(); for (size_t i = 0; i != data.size(); ++i) { - Y_VERIFY(data.at(i) == '.', "must be dot"); + Y_VERIFY(data.at(i) == '.', "must be dot"); } } @@ -279,7 +279,7 @@ public: //delete message; //Sleep(TDuration::MilliSeconds(1)); //continue; - Y_FAIL("unreachable"); + Y_FAIL("unreachable"); } else if (ret == MESSAGE_SHUTDOWN) { delete message; } else { @@ -295,7 +295,7 @@ public: /// actual work is being done here void OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) override { - Y_UNUSED(mess); + Y_UNUSED(mess); if (Config.SimpleProtocol) { VerifyDynamicCast<TSimpleMessage*>(reply.Get()); @@ -310,8 +310,8 @@ public: /// message that could not be delivered void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); - Y_UNUSED(status); + Y_UNUSED(mess); + Y_UNUSED(status); if (TheExit) { return; @@ -319,7 +319,7 @@ public: Stats.IncErrors(); - // Y_ASSERT(TheConfig->Failure > 0.0); + // Y_ASSERT(TheConfig->Failure > 0.0); } }; @@ -368,7 +368,7 @@ public: { /// register destination session Session = TBusServerSession::Create(Proto.Get(), this, Config.ServerSessionConfig, Bus); - Y_ASSERT(Session && "probably somebody is listening on the same port"); + Y_ASSERT(Session && "probably somebody is listening on the same port"); } /// when message comes, send reply @@ -416,8 +416,8 @@ public: : TPerftestServerCommon("server") , TBusModule("fast") { - Y_VERIFY(CreatePrivateSessions(Bus.Get()), "failed to initialize dupdetect module"); - Y_VERIFY(StartInput(), "failed to start input"); + Y_VERIFY(CreatePrivateSessions(Bus.Get()), "failed to initialize dupdetect module"); + Y_VERIFY(StartInput(), "failed to start input"); } ~TPerftestUsingModule() override { @@ -479,7 +479,7 @@ TVector<TNetAddr> ParseNodes(const TString nodes) { for (int i = 0; i < int(numh); i++) { const TNetworkAddress& networkAddress = ParseNetworkAddress(hosts[i].data()); - Y_VERIFY(networkAddress.Begin() != networkAddress.End(), "no addresses"); + Y_VERIFY(networkAddress.Begin() != networkAddress.End(), "no addresses"); r.push_back(TNetAddr(networkAddress, &*networkAddress.Begin())); } @@ -549,9 +549,9 @@ void TTestStats::PeriodicallyPrint() { (unsigned)ServerUsingModule->Bus->GetExecutor()->GetWorkQueueSize(), ServerUsingModule->Session->GetStatusSingleLine().data()); } - for (const auto& client : clients) { + for (const auto& client : clients) { fprintf(stderr, "client: q: %u %s\n", - (unsigned)client->Bus->GetExecutor()->GetWorkQueueSize(), + (unsigned)client->Bus->GetExecutor()->GetWorkQueueSize(), client->Session->GetStatusSingleLine().data()); } @@ -574,13 +574,13 @@ void TTestStats::PeriodicallyPrint() { stats << "server using modules:\n"; stats << IndentText(ServerUsingModule->Bus->GetStatus()); } - for (const auto& client : clients) { + for (const auto& client : clients) { if (!first) { stats << "\n"; } first = false; stats << "client:\n"; - stats << IndentText(client->Bus->GetStatus()); + stats << IndentText(client->Bus->GetStatus()); } TUnbufferedFileOutput("stats").Write(stats.Str()); @@ -693,15 +693,15 @@ int main(int argc, char* argv[]) { if (!clients.empty()) { Cerr << "Stopping clients\n"; - for (auto& client : clients) { - client->Stop(); + for (auto& client : clients) { + client->Stop(); } } wwwServer.Destroy(); - for (const auto& future : futures) { - future->Get(); + for (const auto& future : futures) { + future->Get(); } if (TheConfig->Profile) { diff --git a/library/cpp/messagebus/test/perftest/simple_proto.cpp b/library/cpp/messagebus/test/perftest/simple_proto.cpp index 19d6c15b9d..e478bda000 100644 --- a/library/cpp/messagebus/test/perftest/simple_proto.cpp +++ b/library/cpp/messagebus/test/perftest/simple_proto.cpp @@ -7,7 +7,7 @@ using namespace NBus; void TSimpleProtocol::Serialize(const TBusMessage* mess, TBuffer& data) { - Y_VERIFY(typeid(TSimpleMessage) == typeid(*mess)); + Y_VERIFY(typeid(TSimpleMessage) == typeid(*mess)); const TSimpleMessage* typed = static_cast<const TSimpleMessage*>(mess); data.Append((const char*)&typed->Payload, 4); } diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp index 040f9b7702..b333e2fe23 100644 --- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp +++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp @@ -31,7 +31,7 @@ namespace { } void OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) override { - Y_VERIFY(AtomicGet(SentCompleted), "must be completed"); + Y_VERIFY(AtomicGet(SentCompleted), "must be completed"); TExampleClient::OnReply(mess, reply); @@ -46,7 +46,7 @@ namespace { } -Y_UNIT_TEST_SUITE(TMessageBusTests) { +Y_UNIT_TEST_SUITE(TMessageBusTests) { void TestDestinationTemplate(bool useCompression, bool ackMessageBeforeReply, const TBusServerSessionConfig& sessionConfig) { TObjectCountCheck objectCountCheck; @@ -66,19 +66,19 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_EQUAL(client.Session->GetInFlight(), 0); } - Y_UNIT_TEST(TestDestination) { + Y_UNIT_TEST(TestDestination) { TestDestinationTemplate(false, false, TBusServerSessionConfig()); } - Y_UNIT_TEST(TestDestinationUsingAck) { + Y_UNIT_TEST(TestDestinationUsingAck) { TestDestinationTemplate(false, true, TBusServerSessionConfig()); } - Y_UNIT_TEST(TestDestinationWithCompression) { + Y_UNIT_TEST(TestDestinationWithCompression) { TestDestinationTemplate(true, false, TBusServerSessionConfig()); } - Y_UNIT_TEST(TestCork) { + Y_UNIT_TEST(TestCork) { TBusServerSessionConfig config; config.SendThreshold = 1000000000000; config.Cork = TDuration::MilliSeconds(10); @@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { // TODO: test for cork hanging } - Y_UNIT_TEST(TestReconnect) { + Y_UNIT_TEST(TestReconnect) { if (!IsFixedPortTestAllowed()) { return; } @@ -136,7 +136,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override { - Y_UNUSED(message); + Y_UNUSED(message); Y_VERIFY(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data()); @@ -194,7 +194,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_VALUES_EQUAL(client.Session->GetConfig()->MaxInFlight, count); } - Y_UNIT_TEST(TestHangindServer) { + Y_UNIT_TEST(TestHangindServer) { TObjectCountCheck objectCountCheck; THangingServer server(0); @@ -202,13 +202,13 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { HangingServerImpl(server.GetPort()); } - Y_UNIT_TEST(TestNoServer) { + Y_UNIT_TEST(TestNoServer) { TObjectCountCheck objectCountCheck; TestNoServerImpl(17, false); } - Y_UNIT_TEST(PauseInput) { + Y_UNIT_TEST(PauseInput) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -283,15 +283,15 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.ErrorHappened.WaitI(); } - Y_UNIT_TEST(NoServer_SendTimeout_Callback_PeriodLess) { + Y_UNIT_TEST(NoServer_SendTimeout_Callback_PeriodLess) { NoServer_SendTimeout_Callback_Impl(true); } - Y_UNIT_TEST(NoServer_SendTimeout_Callback_TimeoutLess) { + Y_UNIT_TEST(NoServer_SendTimeout_Callback_TimeoutLess) { NoServer_SendTimeout_Callback_Impl(false); } - Y_UNIT_TEST(TestOnReplyCalledAfterOnMessageSent) { + Y_UNIT_TEST(TestOnReplyCalledAfterOnMessageSent) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -327,7 +327,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnMessage(TOnMessageContext& mess) override { - Y_VERIFY(mess.IsConnectionAlive(), "connection should be alive here"); + Y_VERIFY(mess.IsConnectionAlive(), "connection should be alive here"); TAutoPtr<TOnMessageContext> delayedMsg(new TOnMessageContext); delayedMsg->Swap(mess); auto g(Guard(Lock_)); @@ -337,8 +337,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { bool CheckClientIsAlive() { auto g(Guard(Lock_)); - for (auto& delayedMessage : DelayedMessages) { - if (!delayedMessage->IsConnectionAlive()) { + for (auto& delayedMessage : DelayedMessages) { + if (!delayedMessage->IsConnectionAlive()) { return false; } } @@ -347,8 +347,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { bool CheckClientIsDead() const { auto g(Guard(Lock_)); - for (const auto& delayedMessage : DelayedMessages) { - if (delayedMessage->IsConnectionAlive()) { + for (const auto& delayedMessage : DelayedMessages) { + if (delayedMessage->IsConnectionAlive()) { return false; } } @@ -377,12 +377,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); + Y_UNUSED(mess); Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed, got %s", ToString(status).data()); } }; - Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { + Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { TObjectCountCheck objectCountCheck; TDelayReplyServer server; @@ -431,12 +431,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); - Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed"); + Y_UNUSED(mess); + Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed"); } }; - Y_UNIT_TEST(PackUnpack) { + Y_UNIT_TEST(PackUnpack) { TObjectCountCheck objectCountCheck; TPackUnpackServer server; @@ -446,7 +446,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client->SendMessagesWaitReplies(1, TNetAddr("localhost", server.Session->GetActualListenPort())); } - Y_UNIT_TEST(ClientRequestTooLarge) { + Y_UNIT_TEST(ClientRequestTooLarge) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -505,11 +505,11 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { void OnError(TAutoPtr<TBusMessage>, EMessageStatus status) override { TestSync.WaitForAndIncrement(1); - Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "status"); + Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "status"); } }; - Y_UNIT_TEST(ServerResponseTooLarge) { + Y_UNIT_TEST(ServerResponseTooLarge) { TObjectCountCheck objectCountCheck; TServerForResponseTooLarge server; @@ -555,12 +555,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { TAutoPtr<TExampleResponse> resp(new TExampleResponse(&Proto.ResponseCount, 10)); req.SendReplyMove(resp); } else { - Y_FAIL("wrong"); + Y_FAIL("wrong"); } } }; - Y_UNIT_TEST(ServerRequestTooLarge) { + Y_UNIT_TEST(ServerRequestTooLarge) { TObjectCountCheck objectCountCheck; TServerForRequestTooLarge server; @@ -578,7 +578,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(ClientResponseTooLarge) { + Y_UNIT_TEST(ClientResponseTooLarge) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -598,7 +598,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(ServerUnknownMessage) { + Y_UNIT_TEST(ServerUnknownMessage) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -616,7 +616,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(ServerMessageReservedIds) { + Y_UNIT_TEST(ServerMessageReservedIds) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -641,7 +641,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(TestGetInFlightForDestination) { + Y_UNIT_TEST(TestGetInFlightForDestination) { TObjectCountCheck objectCountCheck; TDelayReplyServer server; @@ -703,7 +703,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(ResetAfterSendOneWayErrorInCallback) { + Y_UNIT_TEST(ResetAfterSendOneWayErrorInCallback) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -739,7 +739,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(ResetAfterSendMessageOneWayDuringShutdown) { + Y_UNIT_TEST(ResetAfterSendMessageOneWayDuringShutdown) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -764,7 +764,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { delete message; } - Y_UNIT_TEST(ResetAfterSendOneWayErrorInReturn) { + Y_UNIT_TEST(ResetAfterSendOneWayErrorInReturn) { TObjectCountCheck objectCountCheck; TestNoServerImpl(17, true); @@ -784,7 +784,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(ResetAfterSendOneWaySuccess) { + Y_UNIT_TEST(ResetAfterSendOneWaySuccess) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -800,7 +800,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.TestSync.WaitForAndIncrement(2); } - Y_UNIT_TEST(GetStatus) { + Y_UNIT_TEST(GetStatus) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -818,7 +818,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.Bus->GetStatus(); } - Y_UNIT_TEST(BindOnRandomPort) { + Y_UNIT_TEST(BindOnRandomPort) { TObjectCountCheck objectCountCheck; TBusServerSessionConfig serverConfig; @@ -829,7 +829,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.SendMessagesWaitReplies(3, &addr); } - Y_UNIT_TEST(UnbindOnShutdown) { + Y_UNIT_TEST(UnbindOnShutdown) { TBusMessageQueuePtr queue(CreateMessageQueue()); TExampleProtocol proto; @@ -846,7 +846,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { THangingServer hangingServer(port); } - Y_UNIT_TEST(VersionNegotiation) { + Y_UNIT_TEST(VersionNegotiation) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -928,7 +928,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(OnClientConnectionEvent_Shutdown) { + Y_UNIT_TEST(OnClientConnectionEvent_Shutdown) { TObjectCountCheck objectCountCheck; TOnConnectionEventServer server; @@ -946,7 +946,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.Sync.WaitForAndIncrement(3); } - Y_UNIT_TEST(OnClientConnectionEvent_Disconnect) { + Y_UNIT_TEST(OnClientConnectionEvent_Disconnect) { TObjectCountCheck objectCountCheck; THolder<TOnConnectionEventServer> server(new TOnConnectionEventServer); @@ -1010,7 +1010,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(WakeReaderOnQuota) { + Y_UNIT_TEST(WakeReaderOnQuota) { const size_t test_msg_count = 64; TBusClientSessionConfig clientConfig; @@ -1061,7 +1061,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { server.WaitForOnMessageCount(test_msg_count); }; - Y_UNIT_TEST(TestConnectionAttempts) { + Y_UNIT_TEST(TestConnectionAttempts) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -1093,7 +1093,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndNotReconnectWhenIdle) { + Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndNotReconnectWhenIdle) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -1120,7 +1120,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); }; - Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndReconnectWhenIdle) { + Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndReconnectWhenIdle) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); diff --git a/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp b/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp index 4083cf3b7b..e7f2f5bd11 100644 --- a/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp @@ -9,7 +9,7 @@ using namespace NBus; using namespace NBus::NTest; -Y_UNIT_TEST_SUITE(ModuleClientOneWay) { +Y_UNIT_TEST_SUITE(ModuleClientOneWay) { struct TTestServer: public TBusServerHandlerError { TExampleProtocol Proto; @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(ModuleClientOneWay) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TTestSync testSync; TTestServer server(&testSync); @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(ModuleClientOneWay) { } }; - Y_UNIT_TEST(SendError) { + Y_UNIT_TEST(SendError) { TTestSync testSync; TBusQueueConfig queueConfig; diff --git a/library/cpp/messagebus/test/ut/module_client_ut.cpp b/library/cpp/messagebus/test/ut/module_client_ut.cpp index ebfe185cc6..16d2f22335 100644 --- a/library/cpp/messagebus/test/ut/module_client_ut.cpp +++ b/library/cpp/messagebus/test/ut/module_client_ut.cpp @@ -50,9 +50,9 @@ public: } }; -Y_UNIT_TEST_SUITE(BusJobTest) { +Y_UNIT_TEST_SUITE(BusJobTest) { #if 0 - Y_UNIT_TEST(TestPending) { + Y_UNIT_TEST(TestPending) { TObjectCountCheck objectCountCheck; TDupDetectModule module; @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { UNIT_ASSERT_EQUAL(msg, pending[0].Message); } - Y_UNIT_TEST(TestCallReplyHandler) { + Y_UNIT_TEST(TestCallReplyHandler) { TObjectCountCheck objectCountCheck; TDupDetectModule module; @@ -112,27 +112,27 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); job->Send(new TExampleRequest(&Proto.RequestCount), Source, TReplyHandler(&TParallelOnReplyModule::ReplyHandler), 0, ServerAddr); return &TParallelOnReplyModule::HandleReplies; } void ReplyHandler(TBusJob*, EMessageStatus status, TBusMessage* mess, TBusMessage* reply) { - Y_UNUSED(mess); - Y_UNUSED(reply); - Y_VERIFY(status == MESSAGE_OK, "failed to get reply: %s", ToCString(status)); + Y_UNUSED(mess); + Y_UNUSED(reply); + Y_VERIFY(status == MESSAGE_OK, "failed to get reply: %s", ToCString(status)); } TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); RepliesLatch.CountDown(); - Y_VERIFY(RepliesLatch.Await(TDuration::Seconds(10)), "failed to get answers"); + Y_VERIFY(RepliesLatch.Await(TDuration::Seconds(10)), "failed to get answers"); job->Cancel(MESSAGE_UNKNOWN); return nullptr; } }; - Y_UNIT_TEST(TestReplyHandlerCalledInParallel) { + Y_UNIT_TEST(TestReplyHandlerCalledInParallel) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -170,7 +170,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); TExampleRequest* message = new TExampleRequest(&Proto.RequestCount); job->Send(message, Source, TReplyHandler(&TErrorHandlerCheckerModule::ReplyHandler), 0, ServerAddr); SentMessage = message; @@ -179,13 +179,13 @@ Y_UNIT_TEST_SUITE(BusJobTest) { void ReplyHandler(TBusJob*, EMessageStatus status, TBusMessage* req, TBusMessage* resp) { Y_VERIFY(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "got wrong status: %s", ToString(status).data()); - Y_VERIFY(req == SentMessage, "checking request"); - Y_VERIFY(resp == nullptr, "checking response"); + Y_VERIFY(req == SentMessage, "checking request"); + Y_VERIFY(resp == nullptr, "checking response"); GotReplyLatch.CountDown(); } TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); job->Cancel(MESSAGE_UNKNOWN); GotReplyLatch.CountDown(); return nullptr; @@ -201,7 +201,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } }; - Y_UNIT_TEST(ErrorHandler) { + Y_UNIT_TEST(ErrorHandler) { TExampleProtocol proto; TBusQueueConfig config; @@ -264,7 +264,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); for (unsigned i = 0; i < 2; ++i) { job->Send( new TExampleRequest(&Proto.RequestCount), @@ -277,9 +277,9 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } void ReplyHandler(TBusJob* job, EMessageStatus status, TBusMessage* mess, TBusMessage* reply) { - Y_UNUSED(mess); - Y_UNUSED(reply); - Y_VERIFY(status == MESSAGE_OK, "failed to get reply"); + Y_UNUSED(mess); + Y_UNUSED(reply); + Y_VERIFY(status == MESSAGE_OK, "failed to get reply"); if (AtomicIncrement(ReplyCount) == 1) { TestSync->WaitForAndIncrement(1); job->SendReply(new TExampleResponse(&Proto.ResponseCount)); @@ -289,7 +289,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); job->Cancel(MESSAGE_UNKNOWN); return nullptr; } @@ -301,7 +301,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } }; - Y_UNIT_TEST(SendReplyCalledBeforeAllRepliesReceived) { + Y_UNIT_TEST(SendReplyCalledBeforeAllRepliesReceived) { TTestSync testSync; TSlowReplyServer slowReplyServer(&testSync); @@ -338,7 +338,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } void HandleReply(TBusJob*, EMessageStatus status, TBusMessage*, TBusMessage*) { - Y_VERIFY(status == MESSAGE_SHUTDOWN, "got %s", ToCString(status)); + Y_VERIFY(status == MESSAGE_SHUTDOWN, "got %s", ToCString(status)); TestSync.CheckAndIncrement(1); } @@ -349,7 +349,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } }; - Y_UNIT_TEST(ShutdownCalledBeforeReplyReceived) { + Y_UNIT_TEST(ShutdownCalledBeforeReplyReceived) { TExampleServer server; server.ForgetRequest = true; diff --git a/library/cpp/messagebus/test/ut/module_server_ut.cpp b/library/cpp/messagebus/test/ut/module_server_ut.cpp index 88fe1dd9b6..4acc9e3f59 100644 --- a/library/cpp/messagebus/test/ut/module_server_ut.cpp +++ b/library/cpp/messagebus/test/ut/module_server_ut.cpp @@ -15,8 +15,8 @@ using namespace NBus; using namespace NBus::NTest; -Y_UNIT_TEST_SUITE(ModuleServerTests) { - Y_UNIT_TEST(TestModule) { +Y_UNIT_TEST_SUITE(ModuleServerTests) { + Y_UNIT_TEST(TestModule) { TObjectCountCheck objectCountCheck; /// create or get instance of message queue, need one per application @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) { TJobHandler Start(TBusJob* job, TBusMessage* mess) override { WaitTwoRequestsLatch.CountDown(); - Y_VERIFY(WaitTwoRequestsLatch.Await(TDuration::Seconds(5)), "oops"); + Y_VERIFY(WaitTwoRequestsLatch.Await(TDuration::Seconds(5)), "oops"); VerifyDynamicCast<TExampleRequest*>(mess); @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) { } }; - Y_UNIT_TEST(TestOnMessageHandlerCalledInParallel) { + Y_UNIT_TEST(TestOnMessageHandlerCalledInParallel) { TObjectCountCheck objectCountCheck; TBusQueueConfig config; @@ -79,18 +79,18 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) { TSystemEvent ClientDiedEvent; TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); MessageReceivedEvent.Signal(); - Y_VERIFY(ClientDiedEvent.WaitT(TDuration::Seconds(5)), "oops"); + Y_VERIFY(ClientDiedEvent.WaitT(TDuration::Seconds(5)), "oops"); job->SendReply(new TExampleResponse(&Proto.ResponseCount)); return nullptr; } }; - Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { + Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { TObjectCountCheck objectCountCheck; TBusQueueConfig config; diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp index 9c21227e2b..7f18da400e 100644 --- a/library/cpp/messagebus/test/ut/one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp @@ -114,7 +114,7 @@ public: void OnMessage(TOnMessageContext& mess) override { TExampleRequest* fmess = static_cast<TExampleRequest*>(mess.GetMessage()); - Y_ASSERT(fmess->Data == "TADA"); + Y_ASSERT(fmess->Data == "TADA"); /// tell session to forget this message and never expect any reply mess.ForgetRequest(); @@ -124,13 +124,13 @@ public: /// this handler should not be called because this server does not send replies void OnSent(TAutoPtr<TBusMessage> mess) override { - Y_UNUSED(mess); - Y_FAIL("This server does not sent replies"); + Y_UNUSED(mess); + Y_FAIL("This server does not sent replies"); } }; -Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { + Y_UNIT_TEST(Simple) { TObjectCountCheck objectCountCheck; NullServer server; @@ -166,15 +166,15 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { } void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); + Y_UNUSED(mess); - Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "wrong status: %s", ToCString(status)); + Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "wrong status: %s", ToCString(status)); GotTooLarge.Signal(); } }; - Y_UNIT_TEST(MessageTooLargeOnClient) { + Y_UNIT_TEST(MessageTooLargeOnClient) { TObjectCountCheck objectCountCheck; NullServer server; @@ -209,14 +209,14 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { /// message that could not be delivered void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); - Y_UNUSED(status); // TODO: check status + Y_UNUSED(mess); + Y_UNUSED(status); // TODO: check status GotError.Signal(); } }; - Y_UNIT_TEST(SendTimeout_Callback_NoServer) { + Y_UNIT_TEST(SendTimeout_Callback_NoServer) { TObjectCountCheck objectCountCheck; TCheckTimeoutClient client(TNetAddr("localhost", 17)); @@ -227,7 +227,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { client.GotError.WaitI(); } - Y_UNIT_TEST(SendTimeout_Callback_HangingServer) { + Y_UNIT_TEST(SendTimeout_Callback_HangingServer) { THangingServer server; TObjectCountCheck objectCountCheck; diff --git a/library/cpp/messagebus/test/ut/starter_ut.cpp b/library/cpp/messagebus/test/ut/starter_ut.cpp index dd4d3aaa5e..76d688b62e 100644 --- a/library/cpp/messagebus/test/ut/starter_ut.cpp +++ b/library/cpp/messagebus/test/ut/starter_ut.cpp @@ -7,7 +7,7 @@ using namespace NBus; using namespace NBus::NTest; -Y_UNIT_TEST_SUITE(TBusStarterTest) { +Y_UNIT_TEST_SUITE(TBusStarterTest) { struct TStartJobTestModule: public TExampleModule { using TBusModule::CreateDefaultStarter; @@ -19,21 +19,21 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); AtomicIncrement(StartCount); job->Sleep(10); return &TStartJobTestModule::End; } TJobHandler End(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); AtomicIncrement(StartCount); job->Cancel(MESSAGE_UNKNOWN); return nullptr; } }; - Y_UNIT_TEST(Test) { + Y_UNIT_TEST(Test) { TObjectCountCheck objectCountCheck; TBusMessageQueuePtr bus(CreateMessageQueue()); @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { bus->Stop(); } - Y_UNIT_TEST(TestModuleStartJob) { + Y_UNIT_TEST(TestModuleStartJob) { TObjectCountCheck objectCountCheck; TExampleProtocol proto; @@ -79,7 +79,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { TSystemEvent MessageReceivedEvent; TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); MessageReceivedEvent.Signal(); @@ -89,12 +89,12 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } TJobHandler Never(TBusJob*, TBusMessage*) { - Y_FAIL("happens"); + Y_FAIL("happens"); throw 1; } }; - Y_UNIT_TEST(StartJobDestroyDuringSleep) { + Y_UNIT_TEST(StartJobDestroyDuringSleep) { TObjectCountCheck objectCountCheck; TExampleProtocol proto; @@ -114,7 +114,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { TSystemEvent MessageReceivedEvent; TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); job->SendReply(new TExampleResponse(&Proto.ResponseCount)); @@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } }; - Y_UNIT_TEST(AllowSendReplyInStarted) { + Y_UNIT_TEST(AllowSendReplyInStarted) { TObjectCountCheck objectCountCheck; TExampleProtocol proto; diff --git a/library/cpp/messagebus/test/ut/sync_client_ut.cpp b/library/cpp/messagebus/test/ut/sync_client_ut.cpp index 400128193f..735aa06569 100644 --- a/library/cpp/messagebus/test/ut/sync_client_ut.cpp +++ b/library/cpp/messagebus/test/ut/sync_client_ut.cpp @@ -50,8 +50,8 @@ namespace NBus { } }; - Y_UNIT_TEST_SUITE(SyncClientTest) { - Y_UNIT_TEST(TestSync) { + Y_UNIT_TEST_SUITE(SyncClientTest) { + Y_UNIT_TEST(TestSync) { TObjectCountCheck objectCountCheck; TExampleServer server; diff --git a/library/cpp/messagebus/use_after_free_checker.cpp b/library/cpp/messagebus/use_after_free_checker.cpp index 4904e7c614..5fc62f7b62 100644 --- a/library/cpp/messagebus/use_after_free_checker.cpp +++ b/library/cpp/messagebus/use_after_free_checker.cpp @@ -13,10 +13,10 @@ TUseAfterFreeChecker::TUseAfterFreeChecker() } TUseAfterFreeChecker::~TUseAfterFreeChecker() { - Y_VERIFY(Magic == VALID, "Corrupted"); + Y_VERIFY(Magic == VALID, "Corrupted"); Magic = INVALID; } void TUseAfterFreeChecker::CheckNotFreed() const { - Y_VERIFY(Magic == VALID, "Freed or corrupted"); + Y_VERIFY(Magic == VALID, "Freed or corrupted"); } diff --git a/library/cpp/messagebus/vector_swaps.h b/library/cpp/messagebus/vector_swaps.h index b920bcf03e..2edcd99114 100644 --- a/library/cpp/messagebus/vector_swaps.h +++ b/library/cpp/messagebus/vector_swaps.h @@ -15,8 +15,8 @@ private: T* EndOfStorage; void StateCheck() { - Y_ASSERT(Start <= Finish); - Y_ASSERT(Finish <= EndOfStorage); + Y_ASSERT(Start <= Finish); + Y_ASSERT(Finish <= EndOfStorage); } public: @@ -69,12 +69,12 @@ public: } T& operator[](size_t index) { - Y_ASSERT(index < size()); + Y_ASSERT(index < size()); return Start[index]; } const T& operator[](size_t index) const { - Y_ASSERT(index < size()); + Y_ASSERT(index < size()); return Start[index]; } @@ -122,7 +122,7 @@ public: size_t newCapacity = FastClp2(n); TVectorSwaps<T> tmp; tmp.Start = (T*)malloc(sizeof(T) * newCapacity); - Y_VERIFY(!!tmp.Start); + Y_VERIFY(!!tmp.Start); tmp.EndOfStorage = tmp.Start + newCapacity; @@ -146,7 +146,7 @@ public: template <class TIterator> void insert(iterator pos, TIterator b, TIterator e) { - Y_VERIFY(pos == end(), "TODO: only insert at the end is implemented"); + Y_VERIFY(pos == end(), "TODO: only insert at the end is implemented"); size_t count = e - b; diff --git a/library/cpp/messagebus/vector_swaps_ut.cpp b/library/cpp/messagebus/vector_swaps_ut.cpp index 693cc6857b..9994cb80b2 100644 --- a/library/cpp/messagebus/vector_swaps_ut.cpp +++ b/library/cpp/messagebus/vector_swaps_ut.cpp @@ -2,8 +2,8 @@ #include "vector_swaps.h" -Y_UNIT_TEST_SUITE(TVectorSwapsTest) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TVectorSwapsTest) { + Y_UNIT_TEST(Simple) { TVectorSwaps<THolder<unsigned>> v; for (unsigned i = 0; i < 100; ++i) { THolder<unsigned> tmp(new unsigned(i)); diff --git a/library/cpp/messagebus/www/html_output.h b/library/cpp/messagebus/www/html_output.h index 27e77adefa..3cbf350c0c 100644 --- a/library/cpp/messagebus/www/html_output.h +++ b/library/cpp/messagebus/www/html_output.h @@ -7,17 +7,17 @@ #include <library/cpp/html/pcdata/pcdata.h> #include <util/system/tls.h> -extern Y_POD_THREAD(IOutputStream*) HtmlOutputStreamPtr; +extern Y_POD_THREAD(IOutputStream*) HtmlOutputStreamPtr; -static IOutputStream& HtmlOutputStream() { - Y_VERIFY(!!HtmlOutputStreamPtr); +static IOutputStream& HtmlOutputStream() { + Y_VERIFY(!!HtmlOutputStreamPtr); return *HtmlOutputStreamPtr; } struct THtmlOutputStreamPushPop { - IOutputStream* const Prev; + IOutputStream* const Prev; - THtmlOutputStreamPushPop(IOutputStream* outputStream) + THtmlOutputStreamPushPop(IOutputStream* outputStream) : Prev(HtmlOutputStreamPtr) { HtmlOutputStreamPtr = outputStream; diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index 62ec241d85..b9540681b3 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -38,7 +38,7 @@ namespace { TVector<std::pair<TString, TValuePtr>> Entries; TValuePtr FindByName(TStringBuf name) { - Y_VERIFY(!!name); + Y_VERIFY(!!name); for (unsigned i = 0; i < Entries.size(); ++i) { if (Entries[i].first == name) { @@ -49,7 +49,7 @@ namespace { } TString FindNameByPtr(TValuePtr value) { - Y_VERIFY(!!value); + Y_VERIFY(!!value); for (unsigned i = 0; i < Entries.size(); ++i) { if (Entries[i].second.Get() == value.Get()) { @@ -57,11 +57,11 @@ namespace { } } - Y_FAIL("unregistered"); + Y_FAIL("unregistered"); } void Add(TValuePtr p) { - Y_VERIFY(!!p); + Y_VERIFY(!!p); // Do not add twice for (unsigned i = 0; i < Entries.size(); ++i) { @@ -187,27 +187,27 @@ struct TBusWww::TImpl { TMutex Mutex; void RegisterClientSession(TBusClientSessionPtr s) { - Y_VERIFY(!!s); + Y_VERIFY(!!s); TGuard<TMutex> g(Mutex); ClientSessions.Add(s.Get()); Queues.Add(s->GetQueue()); } void RegisterServerSession(TBusServerSessionPtr s) { - Y_VERIFY(!!s); + Y_VERIFY(!!s); TGuard<TMutex> g(Mutex); ServerSessions.Add(s.Get()); Queues.Add(s->GetQueue()); } void RegisterQueue(TBusMessageQueuePtr q) { - Y_VERIFY(!!q); + Y_VERIFY(!!q); TGuard<TMutex> g(Mutex); Queues.Add(q); } void RegisterModule(TBusModule* module) { - Y_VERIFY(!!module); + Y_VERIFY(!!module); TGuard<TMutex> g(Mutex); { @@ -239,17 +239,17 @@ struct TBusWww::TImpl { serverSession = ServerSessions.FindByName(sessionName); session = serverSession.Get(); } - Y_VERIFY(!!session); + Y_VERIFY(!!session); return Queues.FindNameByPtr(session->GetQueue()); } struct TRequest { TImpl* const Outer; - IOutputStream& Os; + IOutputStream& Os; const TCgiParameters& CgiParams; const TOptionalParams& Params; - TRequest(TImpl* outer, IOutputStream& os, const TCgiParameters& cgiParams, const TOptionalParams& params) + TRequest(TImpl* outer, IOutputStream& os, const TCgiParameters& cgiParams, const TOptionalParams& params) : Outer(outer) , Os(os) , CgiParams(cgiParams) @@ -681,9 +681,9 @@ struct TBusWww::TImpl { } void ServeSolomonJson(const TString& q, const TString& cs, const TString& ss) { - Y_UNUSED(q); - Y_UNUSED(cs); - Y_UNUSED(ss); + Y_UNUSED(q); + Y_UNUSED(cs); + Y_UNUSED(ss); bool all = q == "" && cs == "" && ss == ""; NMonitoring::TDeprecatedJsonWriter sj(&Os); @@ -720,10 +720,10 @@ struct TBusWww::TImpl { sj.CloseDocument(); } - void ServeStatic(IOutputStream& os, TStringBuf path) { - if (path.EndsWith(".js")) { + void ServeStatic(IOutputStream& os, TStringBuf path) { + if (path.EndsWith(".js")) { os << HTTP_OK_JS; - } else if (path.EndsWith(".png")) { + } else if (path.EndsWith(".png")) { os << HTTP_OK_PNG; } else { os << HTTP_OK_BIN; @@ -799,7 +799,7 @@ struct TBusWww::TImpl { } }; - void ServeHttp(IOutputStream& os, const TCgiParameters& queryArgs, const TBusWww::TOptionalParams& params) { + void ServeHttp(IOutputStream& os, const TCgiParameters& queryArgs, const TBusWww::TOptionalParams& params) { TGuard<TMutex> g(Mutex); TRequest request(this, os, queryArgs, params); @@ -832,7 +832,7 @@ void TBusWww::RegisterModule(TBusModule* module) { Impl->RegisterModule(module); } -void TBusWww::ServeHttp(IOutputStream& httpOutputStream, +void TBusWww::ServeHttp(IOutputStream& httpOutputStream, const TCgiParameters& queryArgs, const TBusWww::TOptionalParams& params) { Impl->ServeHttp(httpOutputStream, queryArgs, params); @@ -843,7 +843,7 @@ struct TBusWwwHttpServer::TImpl: public THttpServer::ICallBack { THttpServer HttpServer; static THttpServer::TOptions MakeHttpServerOptions(unsigned port) { - Y_VERIFY(port > 0); + Y_VERIFY(port > 0); THttpServer::TOptions r; r.Port = port; return r; |