Multi Server Manager.
More...
#include <multisession.hpp>
Multi Server Manager.
Definition at line 45 of file multisession.hpp.
FIX8::ServerManager::ServerManager |
( |
| ) |
|
|
default |
virtual FIX8::ServerManager::~ServerManager |
( |
| ) |
|
|
inlinevirtual |
Dtor.
Definition at line 54 of file multisession.hpp.
std::map< Poco::Net::ServerSocket, ServerSessionBase * > _servermap
Add a ServerSession to the manager; takes ownership of the object
- Parameters
-
- Returns
- true if successful
Definition at line 60 of file multisession.hpp.
References FIX8::ServerSessionBase::_server_sock.
62 if (!what || !what->_server_sock)
63 throw f8Exception(
"bad or missing server socket");
64 _servermap.insert({*what->_server_sock, what});
std::map< Poco::Net::ServerSocket, ServerSessionBase * > _servermap
ServerSessionBase* FIX8::ServerManager::select |
( |
const Poco::Timespan & |
timeout = Poco::Timespan(250000) | ) |
const |
|
inline |
Check to see if there are any waiting inbound connections on any of the managed servers. Will only return the first ServerSession; select should be called continually to process all waiting sockets.
- Parameters
-
timeout | timespan (us, default 250 ms) to wait before returning (will return immediately if connection available) |
- Returns
- pointer to ServerSession that is ready to accept a connection or nullptr if timeout with none
Definition at line 72 of file multisession.hpp.
74 Poco::Net::Socket::SocketList readList, writeList, exceptList;
76 readList.push_back(pp.first);
77 return Poco::Net::Socket::select(readList, writeList, exceptList, timeout) && !readList.empty()
78 ? _servermap.find(readList[0])->second :
nullptr;
std::map< Poco::Net::ServerSocket, ServerSessionBase * > _servermap
size_t FIX8::ServerManager::select_l |
( |
std::vector< ServerSessionBase * > & |
result, |
|
|
const Poco::Timespan & |
timeout = Poco::Timespan(250000) |
|
) |
| const |
|
inline |
Check to see if there are any waiting inbound connections on any of the managed servers. Will add all ServerSession pointers to the supplied vector for all waiting sockets found.
- Parameters
-
result | vector to place results in; will empty before polling |
timeout | timespan (us, default 250 ms) to wait before returning (will return immediately if connection available) |
- Returns
- number of active ServerSockets returned in vector
Definition at line 86 of file multisession.hpp.
89 Poco::Net::Socket::SocketList readList, writeList, exceptList;
91 readList.push_back(pp.first);
92 if (Poco::Net::Socket::select(readList, writeList, exceptList, timeout) && !readList.empty())
93 std::for_each(readList.begin(), readList.end(), [&](decltype(readList)::value_type& pp)
94 { result.push_back(_servermap.find(pp)->second); });
std::map< Poco::Net::ServerSocket, ServerSessionBase * > _servermap
unsigned FIX8::ServerManager::size |
( |
| ) |
const |
|
inline |
Get the number of server sessions being manager by this object
- Returns
- count of server sessions
Definition at line 100 of file multisession.hpp.
100 {
return static_cast<unsigned>(
_servermap.size()); }
std::map< Poco::Net::ServerSocket, ServerSessionBase * > _servermap
std::map<Poco::Net::ServerSocket, ServerSessionBase *> FIX8::ServerManager::_servermap |
|
private |
The documentation for this class was generated from the following file: