Browse Source

Restoring authorship annotation for <vegayours@yandex-team.ru>. Commit 2 of 2.

vegayours 3 years ago
parent
commit
9f9f5936c5

+ 1 - 1
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;

+ 36 - 36
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);
+    };
 };

+ 5 - 5
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
         */

+ 6 - 6
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;