SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ClientSessionStore< SESSION_CLASS > Class Template Reference

#include <ClientManager.h>

Collaboration diagram for ClientSessionStore< SESSION_CLASS >:
Collaboration graph

Classes

struct  ExpectClientInfo
 
struct  WaitingSession
 The WaitingSession struct is used to store sessions without active connections in any server. More...
 

Public Types

using MTGuard = std::lock_guard< std::mutex >
 
using vClients = std::vector< SESSION_CLASS * >
 
using ivClients = typename vClients::iterator
 
using civClients = typename vClients::const_iterator
 

Public Member Functions

ivClients begin ()
 
ivClients end ()
 
civClients begin () const
 
civClients end () const
 
std::mutex & store_lock ()
 
std::mutex & reap_lock ()
 
SESSION_CLASS & create_session (uint64_t token)
 
uint64_t token_for_id (uint32_t id) const
 
void setTokenForId (uint32_t id, uint64_t token)
 
bool has_session_for (uint64_t token) const
 
SESSION_CLASS & session_from_token (uint64_t token)
 
SESSION_CLASS & session_from_event (SEGSEvent *ev)
 
SESSION_CLASS & session_from_event (InternalEvent *ev)
 
uint32_t expect_client_session (uint64_t token, const ACE_INET_Addr &from, uint64_t id)
 
uint32_t get_cookie_for_session (uint64_t token)
 
void session_link_lost (uint64_t token)
 
void remove_by_token (uint64_t token, uint32_t id)
 
uint64_t connected_client (uint32_t cookie)
 
void remove_from_active_sessions (SESSION_CLASS *cl)
 
void add_to_active_sessions (SESSION_CLASS *cl)
 
bool isActive (SESSION_CLASS *c) const
 
size_t num_sessions () const
 
void create_reaping_timer (EventProcessor *tgt, uint32_t id, ACE_Time_Value interval)
 
void mark_session_for_reaping (SESSION_CLASS *sess, uint64_t token)
 
void locked_mark_session_for_reaping (SESSION_CLASS *sess, uint64_t token)
 
void unmark_session_for_reaping (SESSION_CLASS *sess)
 
void locked_unmark_session_for_reaping (SESSION_CLASS *sess)
 
void reap_stale_links (const char *name, ACE_Time_Value link_is_stale_if_disconnected_for, std::function< void(uint64_t token)> reap_callback=[](uint64_t){})
 
SESSION_CLASS * create_or_reuse_session_for (uint64_t token)
 

Protected Member Functions

uint32_t create_cookie (const ACE_INET_Addr &from, uint64_t id)
 

Protected Attributes

std::unique_ptr< SEGSTimerm_session_reaper_timer
 
std::mutex m_store_mutex
 
std::mutex m_reaping_mutex
 
std::unordered_map< uint64_t,
SESSION_CLASS > 
m_token_to_session
 
std::unordered_map< uint32_t,
uint64_t > 
m_id_to_token
 
std::vector< ExpectClientInfom_session_expecting_clients
 
std::vector< WaitingSessionm_session_ready_for_reaping
 
vClients m_active_sessions
 

Member Typedef Documentation

template<class SESSION_CLASS>
using ClientSessionStore< SESSION_CLASS >::civClients = typename vClients::const_iterator
template<class SESSION_CLASS>
using ClientSessionStore< SESSION_CLASS >::ivClients = typename vClients::iterator
template<class SESSION_CLASS>
using ClientSessionStore< SESSION_CLASS >::MTGuard = std::lock_guard<std::mutex>
template<class SESSION_CLASS>
using ClientSessionStore< SESSION_CLASS >::vClients = std::vector<SESSION_CLASS *>

Member Function Documentation

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::add_to_active_sessions ( SESSION_CLASS *  cl)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
ivClients ClientSessionStore< SESSION_CLASS >::begin ( )
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
civClients ClientSessionStore< SESSION_CLASS >::begin ( ) const
inline
template<class SESSION_CLASS>
uint64_t ClientSessionStore< SESSION_CLASS >::connected_client ( uint32_t  cookie)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
uint32_t ClientSessionStore< SESSION_CLASS >::create_cookie ( const ACE_INET_Addr &  from,
uint64_t  id 
)
inlineprotected

Here is the caller graph for this function:

template<class SESSION_CLASS>
SESSION_CLASS* ClientSessionStore< SESSION_CLASS >::create_or_reuse_session_for ( uint64_t  token)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::create_reaping_timer ( EventProcessor tgt,
uint32_t  id,
ACE_Time_Value  interval 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
SESSION_CLASS& ClientSessionStore< SESSION_CLASS >::create_session ( uint64_t  token)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
ivClients ClientSessionStore< SESSION_CLASS >::end ( )
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
civClients ClientSessionStore< SESSION_CLASS >::end ( ) const
inline
template<class SESSION_CLASS>
uint32_t ClientSessionStore< SESSION_CLASS >::expect_client_session ( uint64_t  token,
const ACE_INET_Addr &  from,
uint64_t  id 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
uint32_t ClientSessionStore< SESSION_CLASS >::get_cookie_for_session ( uint64_t  token)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
bool ClientSessionStore< SESSION_CLASS >::has_session_for ( uint64_t  token) const
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
bool ClientSessionStore< SESSION_CLASS >::isActive ( SESSION_CLASS *  c) const
inline
template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::locked_mark_session_for_reaping ( SESSION_CLASS *  sess,
uint64_t  token 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::locked_unmark_session_for_reaping ( SESSION_CLASS *  sess)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::mark_session_for_reaping ( SESSION_CLASS *  sess,
uint64_t  token 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
size_t ClientSessionStore< SESSION_CLASS >::num_sessions ( ) const
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
std::mutex& ClientSessionStore< SESSION_CLASS >::reap_lock ( )
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::reap_stale_links ( const char *  name,
ACE_Time_Value  link_is_stale_if_disconnected_for,
std::function< void(uint64_t token)>  reap_callback = [](uint64_t) {} 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::remove_by_token ( uint64_t  token,
uint32_t  id 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::remove_from_active_sessions ( SESSION_CLASS *  cl)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
SESSION_CLASS& ClientSessionStore< SESSION_CLASS >::session_from_event ( SEGSEvent ev)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
SESSION_CLASS& ClientSessionStore< SESSION_CLASS >::session_from_event ( InternalEvent ev)
inline
template<class SESSION_CLASS>
SESSION_CLASS& ClientSessionStore< SESSION_CLASS >::session_from_token ( uint64_t  token)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::session_link_lost ( uint64_t  token)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::setTokenForId ( uint32_t  id,
uint64_t  token 
)
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
std::mutex& ClientSessionStore< SESSION_CLASS >::store_lock ( )
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
uint64_t ClientSessionStore< SESSION_CLASS >::token_for_id ( uint32_t  id) const
inline

Here is the caller graph for this function:

template<class SESSION_CLASS>
void ClientSessionStore< SESSION_CLASS >::unmark_session_for_reaping ( SESSION_CLASS *  sess)
inline

Here is the caller graph for this function:

Member Data Documentation

template<class SESSION_CLASS>
vClients ClientSessionStore< SESSION_CLASS >::m_active_sessions
protected
template<class SESSION_CLASS>
std::unordered_map<uint32_t,uint64_t> ClientSessionStore< SESSION_CLASS >::m_id_to_token
protected
template<class SESSION_CLASS>
std::mutex ClientSessionStore< SESSION_CLASS >::m_reaping_mutex
protected
template<class SESSION_CLASS>
std::vector<ExpectClientInfo> ClientSessionStore< SESSION_CLASS >::m_session_expecting_clients
protected
template<class SESSION_CLASS>
std::vector<WaitingSession> ClientSessionStore< SESSION_CLASS >::m_session_ready_for_reaping
protected
template<class SESSION_CLASS>
std::unique_ptr<SEGSTimer> ClientSessionStore< SESSION_CLASS >::m_session_reaper_timer
protected
template<class SESSION_CLASS>
std::mutex ClientSessionStore< SESSION_CLASS >::m_store_mutex
mutableprotected
template<class SESSION_CLASS>
std::unordered_map<uint64_t,SESSION_CLASS> ClientSessionStore< SESSION_CLASS >::m_token_to_session
protected

The documentation for this class was generated from the following file: