24 #include "Poco/Net/StreamSocket.h" 26 #include "DebugStream.h" 28 #include "UTCPStream.h" 29 #include "LogAgregator.h" 30 #ifndef DISABLE_REST_API 31 #include <Poco/JSON/Object.h> 42 LogSession(
const Poco::Net::StreamSocket& s, std::shared_ptr<DebugStream>& log, timeout_t cmdTimeout = 2000, timeout_t checkConnectionTime = 10000 );
45 typedef sigc::slot<void, LogSession*> FinalSlot;
46 void connectFinalSession( FinalSlot sl ) noexcept;
50 typedef sigc::signal<std::string, LogSession*, LogServerTypes::Command, const std::string& > LogSessionCommand_Signal;
51 LogSessionCommand_Signal signal_logsession_command();
54 void cancel() noexcept;
56 std::string getClientAddress()
const noexcept;
58 void setSessionLogLevel( Debug::type t ) noexcept;
59 void addSessionLogLevel( Debug::type t ) noexcept;
60 void delSessionLogLevel( Debug::type t ) noexcept;
64 size_t getMaxBufSize()
const noexcept;
67 void run(
const ev::loop_ref& loop ) noexcept;
70 bool isAcive()
const noexcept;
72 std::string name()
const noexcept;
74 std::string getShortInfo() noexcept;
76 #ifndef DISABLE_REST_API 77 Poco::JSON::Object::Ptr httpGetShortInfo();
83 void event( ev::async& watcher,
int revents ) noexcept;
84 void callback( ev::io& watcher,
int revents ) noexcept;
85 void readEvent( ev::io& watcher ) noexcept;
86 void writeEvent( ev::io& watcher );
87 size_t readData(
unsigned char* buf,
int len );
89 void onCmdTimeout( ev::timer& watcher,
int revents ) noexcept;
90 void onCheckConnectionTimer( ev::timer& watcher,
int revents ) noexcept;
91 void final() noexcept;
93 void logOnEvent(
const std::string& s ) noexcept;
95 timeout_t cmdTimeout = { 2000 };
96 double checkConnectionTime = { 10. };
105 size_t maxRecordsNum = { 30000 };
108 std::queue<UTCPCore::Buffer*> logbuf;
109 std::mutex logbuf_mutex;
110 bool lostMsg = {
false };
113 size_t maxCount = { 0 };
114 size_t minSizeMsg = { 0 };
115 size_t maxSizeMsg = { 0 };
116 size_t numLostMsg = { 0 };
118 std::string peername = {
"" };
119 std::string caddr = {
"" };
120 std::shared_ptr<DebugStream> log;
121 std::shared_ptr<LogAgregator> alog;
122 sigc::connection conn;
124 std::shared_ptr<UTCPStream> sock;
128 ev::async asyncEvent;
129 ev::timer checkConnectionTimer;
132 std::atomic_bool cancelled = {
false };
134 LogSessionCommand_Signal m_command_sig;
141 #endif // LogSession_H_ Definition: DebugStream.h:91
Definition: CallbackTimer.h:29
void setMaxBufSize(size_t num)
Установить размер буфера для сообщений (количество записей. Не в байтах!!)
Definition: LogSession.cc:678
Definition: LogServerTypes.h:53
Definition: LogSession.h:38