diff options
author | nga <nga@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:09 +0300 |
commit | c2a1af049e9deca890e9923abe64fe6c59060348 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/acceptor_status.cpp | |
parent | 1f553f46fb4f3c5eec631352cdd900a0709016af (diff) | |
download | ydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz |
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/acceptor_status.cpp')
-rw-r--r-- | library/cpp/messagebus/acceptor_status.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/library/cpp/messagebus/acceptor_status.cpp b/library/cpp/messagebus/acceptor_status.cpp index 3b0725a46b..5006ff68ae 100644 --- a/library/cpp/messagebus/acceptor_status.cpp +++ b/library/cpp/messagebus/acceptor_status.cpp @@ -1,68 +1,68 @@ #include "acceptor_status.h" - -#include "key_value_printer.h" - + +#include "key_value_printer.h" + #include <util/stream/format.h> #include <util/stream/output.h> - -using namespace NBus; -using namespace NBus::NPrivate; - -TAcceptorStatus::TAcceptorStatus() - : Summary(false) - , AcceptorId(0) - , Fd(INVALID_SOCKET) -{ - ResetIncremental(); -} - -void TAcceptorStatus::ResetIncremental() { - AcceptSuccessCount = 0; - AcceptErrorCount = 0; - LastAcceptErrorErrno = 0; - LastAcceptErrorInstant = TInstant(); - LastAcceptSuccessInstant = TInstant(); -} - -TAcceptorStatus& TAcceptorStatus::operator+=(const TAcceptorStatus& that) { + +using namespace NBus; +using namespace NBus::NPrivate; + +TAcceptorStatus::TAcceptorStatus() + : Summary(false) + , AcceptorId(0) + , Fd(INVALID_SOCKET) +{ + ResetIncremental(); +} + +void TAcceptorStatus::ResetIncremental() { + AcceptSuccessCount = 0; + AcceptErrorCount = 0; + LastAcceptErrorErrno = 0; + LastAcceptErrorInstant = TInstant(); + LastAcceptSuccessInstant = TInstant(); +} + +TAcceptorStatus& TAcceptorStatus::operator+=(const TAcceptorStatus& that) { Y_ASSERT(Summary); Y_ASSERT(AcceptorId == 0); - - AcceptSuccessCount += that.AcceptSuccessCount; - LastAcceptSuccessInstant = Max(LastAcceptSuccessInstant, that.LastAcceptSuccessInstant); - - AcceptErrorCount += that.AcceptErrorCount; - if (that.LastAcceptErrorInstant > LastAcceptErrorInstant) { - LastAcceptErrorInstant = that.LastAcceptErrorInstant; - LastAcceptErrorErrno = that.LastAcceptErrorErrno; - } - - return *this; -} - + + AcceptSuccessCount += that.AcceptSuccessCount; + LastAcceptSuccessInstant = Max(LastAcceptSuccessInstant, that.LastAcceptSuccessInstant); + + AcceptErrorCount += that.AcceptErrorCount; + if (that.LastAcceptErrorInstant > LastAcceptErrorInstant) { + LastAcceptErrorInstant = that.LastAcceptErrorInstant; + LastAcceptErrorErrno = that.LastAcceptErrorErrno; + } + + return *this; +} + TString TAcceptorStatus::PrintToString() const { - TStringStream ss; - - if (!Summary) { - ss << "acceptor (" << AcceptorId << "), fd=" << Fd << ", addr=" << ListenAddr << Endl; - } - - TKeyValuePrinter p; - - p.AddRow("accept error count", LeftPad(AcceptErrorCount, 4)); - - if (AcceptErrorCount > 0) { - p.AddRow("last accept error", + TStringStream ss; + + if (!Summary) { + ss << "acceptor (" << AcceptorId << "), fd=" << Fd << ", addr=" << ListenAddr << Endl; + } + + TKeyValuePrinter p; + + p.AddRow("accept error count", LeftPad(AcceptErrorCount, 4)); + + if (AcceptErrorCount > 0) { + p.AddRow("last accept error", TString() + LastSystemErrorText(LastAcceptErrorErrno) + " at " + LastAcceptErrorInstant.ToString()); - } - - p.AddRow("accept success count", LeftPad(AcceptSuccessCount, 4)); - if (AcceptSuccessCount > 0) { - p.AddRow("last accept success", + } + + p.AddRow("accept success count", LeftPad(AcceptSuccessCount, 4)); + if (AcceptSuccessCount > 0) { + p.AddRow("last accept success", TString() + "at " + LastAcceptSuccessInstant.ToString()); - } - - ss << p.PrintToString(); - - return ss.Str(); -} + } + + ss << p.PrintToString(); + + return ss.Str(); +} |