Remote Call Framework 3.3
SessionTimeoutService.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_SESSIONTIMEOUTSERVICE_HPP
19 #define INCLUDE_RCF_SESSIONTIMEOUTSERVICE_HPP
20 
21 #include <set>
22 
23 #include <RCF/Export.hpp>
24 #include <RCF/PeriodicTimer.hpp>
25 #include <RCF/Service.hpp>
26 //#include <RCF/Timer.hpp>
27 
28 namespace RCF {
29 
30  class NetworkSession;
31  typedef std::shared_ptr<NetworkSession> NetworkSessionPtr;
32  typedef std::weak_ptr<NetworkSession> NetworkSessionWeakPtr;
33 
34  class RCF_EXPORT SessionTimeoutService : public I_Service
35  {
36  public:
37  SessionTimeoutService();
38 
39  void restart();
40 
41  private:
42 
43  void onServerStart(RcfServer & server);
44  void onServerStop(RcfServer & server);
45 
46  void onTimer();
47 
48  private:
49 
50  std::vector<NetworkSessionWeakPtr> mSessionsTemp;
51 
52  std::uint32_t mSessionTimeoutMs;
53  std::uint32_t mReapingIntervalMs;
54  RcfServer * mpRcfServer;
55  PeriodicTimer mPeriodicTimer;
56  };
57 
58  typedef std::shared_ptr<SessionTimeoutService> SessionTimeoutServicePtr;
59 
60 } // namespace RCF
61 
62 #endif // ! INCLUDE_RCF_SESSIONTIMEOUTSERVICE_HPP
Definition: AmiIoHandler.hpp:23