|
UniSet
2.0.0
|
00001 // ------------------------------------------------------------------------- 00002 #ifndef LogServer_H_ 00003 #define LogServer_H_ 00004 // ------------------------------------------------------------------------- 00005 #include <list> 00006 #include <string> 00007 #include <cc++/socket.h> 00008 #include "Mutex.h" 00009 #include "DebugStream.h" 00010 #include "ThreadCreator.h" 00011 class LogSession; 00012 // ------------------------------------------------------------------------- 00046 // ------------------------------------------------------------------------- 00047 class LogServer 00048 { 00049 public: 00050 00051 LogServer( DebugStream& log ); 00052 LogServer( std::ostream& os ); 00053 ~LogServer(); 00054 00055 inline void setSessionTimeout( timeout_t msec ){ sessTimeout = msec; } 00056 inline void setCmdTimeout( timeout_t msec ){ cmdTimeout = msec; } 00057 inline void setOutTimeout( timeout_t msec ){ outTimeout = msec; } 00058 00059 void run( const std::string& addr, ost::tpport_t port, bool thread=true ); 00060 00061 protected: 00062 LogServer(); 00063 00064 void work(); 00065 void sessionFinished( LogSession* s ); 00066 00067 private: 00068 typedef std::list<LogSession*> SessionList; 00069 SessionList slist; 00070 UniSetTypes::uniset_rwmutex mutSList; 00071 00072 timeout_t timeout; 00073 timeout_t sessTimeout; 00074 timeout_t cmdTimeout; 00075 timeout_t outTimeout; 00076 00077 std::atomic_bool cancelled; 00078 DebugStream mylog; 00079 ThreadCreator<LogServer>* thr; 00080 00081 ost::TCPSocket* tcp; 00082 DebugStream* elog; 00083 std::ostream* oslog; 00084 }; 00085 // ------------------------------------------------------------------------- 00086 #endif // LogServer_H_ 00087 // -------------------------------------------------------------------------
1.7.6.1