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 | 9f9f5936c5b484e8a48c009cf84feeca7ec3d03a (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library | |
parent | b9b7aa7f3855cbc4d6cd032a89adbc25e680a4df (diff) | |
download | ydb-9f9f5936c5b484e8a48c009cf84feeca7ec3d03a.tar.gz |
Restoring authorship annotation for <vegayours@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library')
-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 eabbbbeaf4..8c7a6db3a8 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 a549e716d1..040f9b7702 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 067fb8c1f6..bfda1fb7e6 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 74e20acd8f..18a554d732 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; |