Browse Source

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

prout 3 years ago
parent
commit
d2247f243d

+ 1 - 1
library/cpp/coroutine/engine/cont_poller.h

@@ -102,7 +102,7 @@ namespace NCoro {
         struct TValue: public T, public TObjectFromPool<TValue> {
             TValue() {}
         };
- 
+
     public:
         TBigArray()
             : Pool_(TMemoryPool::TExpGrow::Instance(), TDefaultAllocator::Instance())

+ 51 - 51
library/cpp/coroutine/engine/coroutine_ut.cpp

@@ -326,99 +326,99 @@ void TCoroTest::TestCondVar() {
 }
 
 namespace NCoroTestJoin {
-    struct TSleepCont { 
-        const TInstant Deadline; 
-        int Result; 
- 
-        inline void operator()(TCont* c) { 
-            Result = c->SleepD(Deadline); 
-        } 
-    }; 
- 
-    struct TReadCont { 
-        const TInstant Deadline; 
-        const SOCKET Sock; 
-        int Result; 
- 
-        inline void operator()(TCont* c) { 
-            char buf = 0; 
+    struct TSleepCont {
+        const TInstant Deadline;
+        int Result;
+
+        inline void operator()(TCont* c) {
+            Result = c->SleepD(Deadline);
+        }
+    };
+
+    struct TReadCont {
+        const TInstant Deadline;
+        const SOCKET Sock;
+        int Result;
+
+        inline void operator()(TCont* c) {
+            char buf = 0;
             Result = NCoro::ReadD(c, Sock, &buf, sizeof(buf), Deadline).Status();
-        } 
-    }; 
- 
-    struct TJoinCont { 
-        const TInstant Deadline; 
-        TCont* const Cont; 
-        bool Result; 
- 
-        inline void operator()(TCont* c) { 
-            Result = c->Join(Cont, Deadline); 
-        } 
-    }; 
- 
+        }
+    };
+
+    struct TJoinCont {
+        const TInstant Deadline;
+        TCont* const Cont;
+        bool Result;
+
+        inline void operator()(TCont* c) {
+            Result = c->Join(Cont, Deadline);
+        }
+    };
+
     void DoTestJoin(EContPoller pollerType) {
         auto poller = IPollerFace::Construct(pollerType);
- 
+
         if (!poller) {
             return;
         }
- 
+
         TContExecutor e(32000, std::move(poller));
- 
+
         TPipe in, out;
         TPipe::Pipe(in, out);
         SetNonBlock(in.GetHandle());
- 
+
         {
             TSleepCont sc = {TInstant::Max(), 0};
             TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
- 
+
             e.Execute(jc);
- 
+
             UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
             UNIT_ASSERT_EQUAL(jc.Result, false);
         }
- 
+
         {
             TSleepCont sc = {TDuration::MilliSeconds(100).ToDeadLine(), 0};
             TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(sc, "sc"), false};
- 
+
             e.Execute(jc);
- 
+
             UNIT_ASSERT_EQUAL(sc.Result, ETIMEDOUT);
             UNIT_ASSERT_EQUAL(jc.Result, true);
         }
- 
+
         {
             TSleepCont sc = {TDuration::MilliSeconds(200).ToDeadLine(), 0};
             TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
- 
+
             e.Execute(jc);
- 
+
             UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
             UNIT_ASSERT_EQUAL(jc.Result, false);
         }
- 
+
         {
             TReadCont rc = {TInstant::Max(), in.GetHandle(), 0};
             TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
- 
+
             e.Execute(jc);
- 
+
             UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
             UNIT_ASSERT_EQUAL(jc.Result, false);
         }
- 
+
         {
             TReadCont rc = {TDuration::MilliSeconds(100).ToDeadLine(), in.GetHandle(), 0};
             TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(rc, "rc"), false};
- 
+
             e.Execute(jc);
- 
+
             UNIT_ASSERT_EQUAL(rc.Result, ETIMEDOUT);
             UNIT_ASSERT_EQUAL(jc.Result, true);
         }
- 
+
         {
             TReadCont rc = {TDuration::MilliSeconds(200).ToDeadLine(), in.GetHandle(), 0};
             TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
@@ -428,9 +428,9 @@ namespace NCoroTestJoin {
             UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
             UNIT_ASSERT_EQUAL(jc.Result, false);
         }
-    } 
-} 
- 
+    }
+}
+
 void TCoroTest::TestJoinDefault() {
     NCoroTestJoin::DoTestJoin(EContPoller::Default);
 }

+ 1 - 1
library/cpp/coroutine/engine/impl.h

@@ -104,7 +104,7 @@ public:
     void SwitchTo(TExceptionSafeContext* ctx) {
         Trampoline_.SwitchTo(ctx);
     }
- 
+
 private:
     void Terminate();
 

+ 111 - 111
library/cpp/coroutine/listener/listen.cpp

@@ -10,39 +10,39 @@
 
 using namespace NAddr;
 
-namespace { 
-    union TSa { 
-        const sockaddr* Sa; 
-        const sockaddr_in* In; 
-        const sockaddr_in6* In6; 
- 
+namespace {
+    union TSa {
+        const sockaddr* Sa;
+        const sockaddr_in* In;
+        const sockaddr_in6* In6;
+
         inline TSa(const sockaddr* sa) noexcept
-            : Sa(sa) 
-        { 
-        } 
- 
+            : Sa(sa)
+        {
+        }
+
         inline bool operator==(const TSa& r) const noexcept {
-            if (Sa->sa_family == r.Sa->sa_family) { 
-                switch (Sa->sa_family) { 
+            if (Sa->sa_family == r.Sa->sa_family) {
+                switch (Sa->sa_family) {
                     case AF_INET:
                         return In->sin_port == r.In->sin_port && In->sin_addr.s_addr == r.In->sin_addr.s_addr;
                     case AF_INET6:
                         return In6->sin6_port == r.In6->sin6_port && !memcmp(&In6->sin6_addr, &r.In6->sin6_addr, sizeof(in6_addr));
-                } 
-            } 
- 
-            return false; 
-        } 
- 
+                }
+            }
+
+            return false;
+        }
+
         inline bool operator!=(const TSa& r) const noexcept {
-            return !(*this == r); 
-        } 
-    }; 
-} 
- 
+            return !(*this == r);
+        }
+    };
+}
+
 class TContListener::TImpl {
-private: 
-    struct TStoredAddrInfo: public TAddrInfo, private TNetworkAddress { 
+private:
+    struct TStoredAddrInfo: public TAddrInfo, private TNetworkAddress {
         inline TStoredAddrInfo(const struct addrinfo* ai, const TNetworkAddress& addr) noexcept
             : TAddrInfo(ai)
             , TNetworkAddress(addr)
@@ -50,7 +50,7 @@ private:
         }
     };
 
-private: 
+private:
     class TOneSocketListener: public TIntrusiveListItem<TOneSocketListener> {
     public:
         inline TOneSocketListener(TImpl* parent, IRemoteAddrPtr addr)
@@ -88,10 +88,10 @@ private:
             Stop();
         }
 
-    public: 
+    public:
         inline void Run(TCont* cont) noexcept {
-            C_ = cont; 
-            DoRun(); 
+            C_ = cont;
+            DoRun();
             C_ = nullptr;
         }
 
@@ -127,7 +127,7 @@ private:
 
     private:
         inline void DoRun() noexcept {
-            while (!C_->Cancelled()) { 
+            while (!C_->Cancelled()) {
                 try {
                     TOpaqueAddr remote;
                     const int res = NCoro::AcceptI(C_, ListenSocket_, remote.MutableAddr(), remote.LenPtr());
@@ -164,49 +164,49 @@ private:
                 }
             }
 
-            try { 
-                Parent_->Cb_->OnStop(&ListenSocket_); 
-            } catch (...) { 
-            } 
+            try {
+                Parent_->Cb_->OnStop(&ListenSocket_);
+            } catch (...) {
+            }
         }
 
     private:
-        const TImpl* const Parent_; 
+        const TImpl* const Parent_;
         TCont* C_;
         TSocketHolder ListenSocket_;
-        const IRemoteAddrPtr Addr_; 
+        const IRemoteAddrPtr Addr_;
     };
 
-private: 
-    class TListeners: public TIntrusiveListWithAutoDelete<TOneSocketListener, TDelete> { 
-    private: 
-        template <class T> 
+private:
+    class TListeners: public TIntrusiveListWithAutoDelete<TOneSocketListener, TDelete> {
+    private:
+        template <class T>
         using TIt = std::conditional_t<std::is_const<T>::value, typename T::TConstIterator, typename T::TIterator>;
- 
-        template <class T> 
+
+        template <class T>
         static inline TIt<T> FindImpl(T* t, const IRemoteAddr& addr) {
-            const TSa sa(addr.Addr()); 
- 
+            const TSa sa(addr.Addr());
+
             TIt<T> it = t->Begin();
             TIt<T> const end = t->End();
- 
-            while (it != end && sa != it->Addr()->Addr()) { 
-                ++it; 
-            } 
- 
-            return it; 
-        } 
- 
-    public: 
-        inline TIterator Find(const IRemoteAddr& addr) { 
-            return FindImpl(this, addr); 
-        } 
- 
-        inline TConstIterator Find(const IRemoteAddr& addr) const { 
-            return FindImpl(this, addr); 
-        } 
-    }; 
- 
+
+            while (it != end && sa != it->Addr()->Addr()) {
+                ++it;
+            }
+
+            return it;
+        }
+
+    public:
+        inline TIterator Find(const IRemoteAddr& addr) {
+            return FindImpl(this, addr);
+        }
+
+        inline TConstIterator Find(const IRemoteAddr& addr) const {
+            return FindImpl(this, addr);
+        }
+    };
+
 public:
     inline TImpl(ICallBack* cb, TContExecutor* e, const TOptions& opts) noexcept
         : E_(e)
@@ -221,18 +221,18 @@ public:
         }
     }
 
-    inline void Listen(const IRemoteAddr& addr) { 
-        const TListeners::TIterator it = L_.Find(addr); 
- 
-        if (it != L_.End()) { 
-            it->StartListen(); 
-        } 
-    } 
- 
-    inline void Bind(const IRemoteAddr& addr) { 
-        const TSa sa(addr.Addr()); 
- 
-        switch (sa.Sa->sa_family) { 
+    inline void Listen(const IRemoteAddr& addr) {
+        const TListeners::TIterator it = L_.Find(addr);
+
+        if (it != L_.End()) {
+            it->StartListen();
+        }
+    }
+
+    inline void Bind(const IRemoteAddr& addr) {
+        const TSa sa(addr.Addr());
+
+        switch (sa.Sa->sa_family) {
             case AF_INET:
                 L_.PushBack(new TOneSocketListener(this, MakeHolder<TIPv4Addr>(*sa.In)));
                 break;
@@ -241,9 +241,9 @@ public:
                 break;
             default:
                 ythrow yexception() << TStringBuf("unknown protocol");
-        } 
-    } 
- 
+        }
+    }
+
     inline void Bind(const TIpAddress& addr) {
         L_.PushBack(new TOneSocketListener(this, MakeHolder<TIPv4Addr>(addr)));
     }
@@ -254,17 +254,17 @@ public:
         }
     }
 
-    inline void StopListenAddr(const IRemoteAddr& addr) { 
-        const TListeners::TIterator it = L_.Find(addr); 
+    inline void StopListenAddr(const IRemoteAddr& addr) {
+        const TListeners::TIterator it = L_.Find(addr);
 
-        if (it != L_.End()) { 
-            delete &*it; 
+        if (it != L_.End()) {
+            delete &*it;
         }
     }
 
 private:
-    TContExecutor* const E_; 
-    ICallBack* const Cb_; 
+    TContExecutor* const E_;
+    ICallBack* const Cb_;
     TListeners L_;
     const TOptions Opts_;
 };
@@ -285,33 +285,33 @@ namespace {
     }
 }
 
-void TContListener::Listen(const IRemoteAddr& addr) { 
+void TContListener::Listen(const IRemoteAddr& addr) {
     CheckImpl(Impl_)->Listen(addr);
 }
 
-void TContListener::Listen(const TIpAddress& addr) { 
-    return Listen(TIPv4Addr(addr)); 
-} 
- 
-void TContListener::Listen(const TNetworkAddress& addr) { 
-    for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) { 
-        Listen(TAddrInfo(&*it)); 
+void TContListener::Listen(const TIpAddress& addr) {
+    return Listen(TIPv4Addr(addr));
+}
+
+void TContListener::Listen(const TNetworkAddress& addr) {
+    for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) {
+        Listen(TAddrInfo(&*it));
     }
-} 
+}
 
-void TContListener::Listen() { 
+void TContListener::Listen() {
     CheckImpl(Impl_)->Listen();
-} 
- 
-void TContListener::Bind(const IRemoteAddr& addr) { 
+}
+
+void TContListener::Bind(const IRemoteAddr& addr) {
     CheckImpl(Impl_)->Bind(addr);
 }
 
-void TContListener::Bind(const TIpAddress& addr) { 
-    return Bind(TIPv4Addr(addr)); 
-} 
+void TContListener::Bind(const TIpAddress& addr) {
+    return Bind(TIPv4Addr(addr));
+}
 
-void TContListener::Bind(const TNetworkAddress& addr) { 
+void TContListener::Bind(const TNetworkAddress& addr) {
     CheckImpl(Impl_)->Bind(addr);
 }
 
@@ -319,18 +319,18 @@ void TContListener::Stop() noexcept {
     Impl_.Destroy();
 }
 
-void TContListener::StopListenAddr(const IRemoteAddr& addr) { 
+void TContListener::StopListenAddr(const IRemoteAddr& addr) {
     CheckImpl(Impl_)->StopListenAddr(addr);
 }
 
-void TContListener::StopListenAddr(const TIpAddress& addr) { 
-    return StopListenAddr(TIPv4Addr(addr)); 
+void TContListener::StopListenAddr(const TIpAddress& addr) {
+    return StopListenAddr(TIPv4Addr(addr));
 }
 
-void TContListener::StopListenAddr(const TNetworkAddress& addr) { 
-    for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) { 
-        StopListenAddr(TAddrInfo(&*it)); 
-    } 
+void TContListener::StopListenAddr(const TNetworkAddress& addr) {
+    for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) {
+        StopListenAddr(TAddrInfo(&*it));
+    }
 }
 
 void TContListener::ICallBack::OnAcceptFull(const TAcceptFull& params) {
@@ -348,7 +348,7 @@ void TContListener::ICallBack::OnAcceptFull(const TAcceptFull& params) {
     }
 }
 
-void TContListener::ICallBack::OnStop(TSocketHolder* s) { 
-    s->ShutDown(SHUT_RDWR); 
-    s->Close(); 
-} 
+void TContListener::ICallBack::OnStop(TSocketHolder* s) {
+    s->ShutDown(SHUT_RDWR);
+    s->Close();
+}

+ 18 - 18
library/cpp/coroutine/listener/listen.h

@@ -86,8 +86,8 @@ public:
          */
         virtual void OnError() = 0;
 
-        virtual void OnStop(TSocketHolder*); 
- 
+        virtual void OnStop(TSocketHolder*);
+
         virtual ~ICallBack() {
         }
     };
@@ -97,28 +97,28 @@ public:
 
     /// start listener threads
     void Listen();
- 
-    void Listen(const NAddr::IRemoteAddr& addr); 
-    void Listen(const TIpAddress& addr); 
-    void Listen(const TNetworkAddress& addr); 
- 
+
+    void Listen(const NAddr::IRemoteAddr& addr);
+    void Listen(const TIpAddress& addr);
+    void Listen(const TNetworkAddress& addr);
+
     /// bind server on address. Can be called multiple times to bind on more then one address
-    void Bind(const NAddr::IRemoteAddr& addr); 
+    void Bind(const NAddr::IRemoteAddr& addr);
     void Bind(const TIpAddress& addr);
     void Bind(const TNetworkAddress& addr);
- 
+
     void Stop() noexcept;
 
-    void StopListenAddr(const NAddr::IRemoteAddr& addr); 
+    void StopListenAddr(const NAddr::IRemoteAddr& addr);
     void StopListenAddr(const TIpAddress& addr);
-    void StopListenAddr(const TNetworkAddress& addr); 
-
-    template <class T> 
-    inline void StartListenAddr(const T& addr) { 
-        Bind(addr); 
-        Listen(addr); 
-    } 
- 
+    void StopListenAddr(const TNetworkAddress& addr);
+
+    template <class T>
+    inline void StartListenAddr(const T& addr) {
+        Bind(addr);
+        Listen(addr);
+    }
+
 private:
     class TImpl;
     THolder<TImpl> Impl_;

+ 4 - 4
library/cpp/digest/ya.make

@@ -1,4 +1,4 @@
-RECURSE( 
+RECURSE(
     argonish
     argonish/benchmark
     argonish/ut_fat
@@ -11,8 +11,8 @@ RECURSE(
     md5/ut
     md5/medium_ut
     md5/bench
-    murmur 
-    murmur/ut 
+    murmur
+    murmur/ut
     crc32c
     crc32c/ut
     old_crc
@@ -20,4 +20,4 @@ RECURSE(
     old_crc/gencrc
     sfh
     sfh/ut
-) 
+)

+ 1 - 1
library/cpp/http/fetch/exthttpcodes.cpp

@@ -174,7 +174,7 @@ ui16* http2status = prepare_flags(HTTP_FLAG);
 
 TStringBuf ExtHttpCodeStr(int code) noexcept {
     if (code < HTTP_CODE_MAX) {
-        return HttpCodeStr(code); 
+        return HttpCodeStr(code);
     }
     switch (code) {
         case HTTP_BAD_RESPONSE_HEADER:

+ 2 - 2
library/cpp/http/misc/httpcodes.cpp

@@ -1,7 +1,7 @@
 #include "httpcodes.h"
 
 TStringBuf HttpCodeStrEx(int code) noexcept {
-    switch (code) { 
+    switch (code) {
         case HTTP_CONTINUE:
             return TStringBuf("100 Continue");
         case HTTP_SWITCHING_PROTOCOLS:
@@ -137,5 +137,5 @@ TStringBuf HttpCodeStrEx(int code) noexcept {
 
         default:
             return TStringBuf("000 Unknown HTTP code");
-    } 
+    }
 }

+ 7 - 7
library/cpp/http/misc/httpcodes.h

@@ -1,7 +1,7 @@
 #pragma once
 
-#include <util/generic/strbuf.h> 
- 
+#include <util/generic/strbuf.h>
+
 enum HttpCodes {
     HTTP_CONTINUE = 100,
     HTTP_SWITCHING_PROTOCOLS = 101,
@@ -76,14 +76,14 @@ enum HttpCodes {
 };
 
 TStringBuf HttpCodeStrEx(int code) noexcept;
- 
+
 inline TStringBuf HttpCodeStr(int code) noexcept {
-    return HttpCodeStrEx(code).Skip(4); 
-} 
- 
+    return HttpCodeStrEx(code).Skip(4);
+}
+
 inline bool IsHttpCode(int code) noexcept {
     return HttpCodeStrEx(code).data() != HttpCodeStrEx(0).data();
-} 
+}
 
 inline bool IsUserError(int code) noexcept {
     return code >= 400 && code < 500;

+ 5 - 5
library/cpp/logger/log.cpp

@@ -69,8 +69,8 @@ public:
     inline void AddLog(ELogPriority priority, const char* format, va_list args) const {
         if (!IsOpen()) {
             return;
-        } 
- 
+        }
+
         TPriorityLogStream ls(priority, this);
 
         Printf(ls, format, args);
@@ -223,9 +223,9 @@ bool TLog::IsNullLog() const noexcept {
 }
 
 THolder<TLogBackend> TLog::ReleaseBackend() noexcept {
-    return Impl_->ReleaseBackend(); 
-} 
- 
+    return Impl_->ReleaseBackend();
+}
+
 void TLog::Write(ELogPriority priority, const char* data, size_t len) const {
     if (Formatter_) {
         const auto formated = Formatter_(priority, TStringBuf{data, len});

Some files were not shown because too many files changed in this diff