diff options
author | vegayours <vegayours@yandex-team.ru> | 2022-02-10 16:50:31 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:31 +0300 |
commit | b9b7aa7f3855cbc4d6cd032a89adbc25e680a4df (patch) | |
tree | 84d4a0f0857da118debdb9684b64ab00acb42206 | |
parent | b1683877992937b1040baa621c4b216ed8405729 (diff) | |
download | ydb-b9b7aa7f3855cbc4d6cd032a89adbc25e680a4df.tar.gz |
Restoring authorship annotation for <vegayours@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/messagebus/remote_client_connection.cpp | 2 | ||||
-rw-r--r-- | library/cpp/messagebus/test/ut/messagebus_ut.cpp | 72 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-document-decl.h | 10 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-document.cpp | 12 |
4 files changed, 48 insertions, 48 deletions
diff --git a/library/cpp/messagebus/remote_client_connection.cpp b/library/cpp/messagebus/remote_client_connection.cpp index 8c7a6db3a8..eabbbbeaf4 100644 --- a/library/cpp/messagebus/remote_client_connection.cpp +++ b/library/cpp/messagebus/remote_client_connection.cpp @@ -76,7 +76,7 @@ void TRemoteClientConnection::TryConnect() { WriterData.SetChannel(Session->WriteEventLoop.Register(connectSocket, this, WriteCookie)); } - if (BeforeSendQueue.IsEmpty() && WriterData.SendQueue.Empty() && !Config.ReconnectWhenIdle) { + if (BeforeSendQueue.IsEmpty() && WriterData.SendQueue.Empty() && !Config.ReconnectWhenIdle) { // TryConnect is called from Writer::Act, which is called in cycle // from session's ScheduleTimeoutMessages via Cron. This prevent these excessive connects. return; diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp index 040f9b7702..a549e716d1 100644 --- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp +++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp @@ -130,12 +130,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { : TExampleClient(std::forward<Args>(args)...) { } - + ~TestNoServerImplClient() override { Session->Shutdown(); } - void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override { + void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override { Y_UNUSED(message); Y_VERIFY(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data()); @@ -1066,8 +1066,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { TNetAddr noServerAddr("localhost", 17); TBusClientSessionConfig clientConfig; - clientConfig.RetryInterval = 100; - TestNoServerImplClient client(clientConfig); + clientConfig.RetryInterval = 100; + TestNoServerImplClient client(clientConfig); int count = 0; for (; count < 10; ++count) { @@ -1098,9 +1098,9 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { TNetAddr noServerAddr("localhost", 17); TBusClientSessionConfig clientConfig; - clientConfig.RetryInterval = 100; - clientConfig.ReconnectWhenIdle = false; - TestNoServerImplClient client(clientConfig); + clientConfig.RetryInterval = 100; + clientConfig.ReconnectWhenIdle = false; + TestNoServerImplClient client(clientConfig); int count = 0; for (; count < 10; ++count) { @@ -1114,38 +1114,38 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); } - Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2)); + Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2)); UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); - Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval)); + Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval)); UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); }; - + Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndReconnectWhenIdle) { - TObjectCountCheck objectCountCheck; - - TNetAddr noServerAddr("localhost", 17); - TBusClientSessionConfig clientConfig; - clientConfig.ReconnectWhenIdle = true; - clientConfig.RetryInterval = 100; - TestNoServerImplClient client(clientConfig); - - int count = 0; - for (; count < 10; ++count) { - EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount), - &noServerAddr); - + TObjectCountCheck objectCountCheck; + + TNetAddr noServerAddr("localhost", 17); + TBusClientSessionConfig clientConfig; + clientConfig.ReconnectWhenIdle = true; + clientConfig.RetryInterval = 100; + TestNoServerImplClient client(clientConfig); + + int count = 0; + for (; count < 10; ++count) { + EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount), + &noServerAddr); + Y_VERIFY(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data()); - client.TestSync.WaitForAndIncrement(count * 2 + 1); - - // First connection attempt is for connect call; second one is to get connect result. - UNIT_ASSERT_VALUES_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); - } - - Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2)); - UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); - Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval)); - // it is undeterministic how many reconnects will be during that amount of time - // but it should occur at least once - UNIT_ASSERT(client.Session->GetConnectSyscallsNumForTest(noServerAddr) > 2); - }; + client.TestSync.WaitForAndIncrement(count * 2 + 1); + + // First connection attempt is for connect call; second one is to get connect result. + UNIT_ASSERT_VALUES_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); + } + + Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2)); + UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); + Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval)); + // it is undeterministic how many reconnects will be during that amount of time + // but it should occur at least once + UNIT_ASSERT(client.Session->GetConnectSyscallsNumForTest(noServerAddr) > 2); + }; }; diff --git a/library/cpp/xml/document/xml-document-decl.h b/library/cpp/xml/document/xml-document-decl.h index bfda1fb7e6..067fb8c1f6 100644 --- a/library/cpp/xml/document/xml-document-decl.h +++ b/library/cpp/xml/document/xml-document-decl.h @@ -440,11 +440,11 @@ namespace NXml { */ bool IsText() const; - /** - * unlink node from parent and free - */ - void Remove(); - + /** + * unlink node from parent and free + */ + void Remove(); + /** * constructs null node */ diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp index 18a554d732..74e20acd8f 100644 --- a/library/cpp/xml/document/xml-document.cpp +++ b/library/cpp/xml/document/xml-document.cpp @@ -300,12 +300,12 @@ namespace NXml { return NodePointer->type == XML_TEXT_NODE; } - void TNode::Remove() { - xmlNode* nodePtr = GetPtr(); - xmlUnlinkNode(nodePtr); - xmlFreeNode(nodePtr); - } - + void TNode::Remove() { + xmlNode* nodePtr = GetPtr(); + xmlUnlinkNode(nodePtr); + xmlFreeNode(nodePtr); + } + static int XmlWriteToOstream(void* context, const char* buffer, int len) { // possibly use to save doc as well IOutputStream* out = (IOutputStream*)context; |