Remote Call Framework 3.1
SessionTimeoutService.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2019, Delta V Software. All rights reserved.
6 // http://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
12 // under GPL terms.
13 //
14 // Version: 3.1
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_SESSIONTIMEOUTSERVICE_HPP
20 #define INCLUDE_RCF_SESSIONTIMEOUTSERVICE_HPP
21 
22 #include <set>
23 
24 #include <RCF/Export.hpp>
25 #include <RCF/PeriodicTimer.hpp>
26 #include <RCF/Service.hpp>
27 //#include <RCF/Timer.hpp>
28 
29 namespace RCF {
30 
31  class NetworkSession;
32  typedef std::shared_ptr<NetworkSession> NetworkSessionPtr;
33  typedef std::weak_ptr<NetworkSession> NetworkSessionWeakPtr;
34 
35  class RCF_EXPORT SessionTimeoutService : public I_Service
36  {
37  public:
38  SessionTimeoutService();
39 
40  private:
41 
42  void onServerStart(RcfServer & server);
43  void onServerStop(RcfServer & server);
44 
45  void onTimer();
46 
47  private:
48 
49  std::vector<NetworkSessionWeakPtr> mSessionsTemp;
50 
51  std::uint32_t mSessionTimeoutMs;
52  std::uint32_t mReapingIntervalMs;
53  RcfServer * mpRcfServer;
54  PeriodicTimer mPeriodicTimer;
55  };
56 
57  typedef std::shared_ptr<SessionTimeoutService> SessionTimeoutServicePtr;
58 
59 } // namespace RCF
60 
61 #endif // ! INCLUDE_RCF_SESSIONTIMEOUTSERVICE_HPP
Definition: AmiIoHandler.hpp:24