|
Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
|
#include <boost/multi_index_container.hpp>#include <boost/multi_index/hashed_index.hpp>#include <boost/multi_index/member.hpp>#include <iostream>#include <boost/asio.hpp>#include <memory>#include <array>#include <queue>#include <vector>#include <mutex>#include <thread>#include <string>#include <optional>#include "shared/network/packet.hpp"#include "shared/utilities/typedefs.hpp"Go to the source code of this file.
Data Structures | |
| struct | SessionInfo |
| class | Session |
| struct | SessionEntry |
| struct | ip_address_hash |
| struct | IndexByID |
| struct | IndexByIP |
Typedefs | |
| using | Sessions = boost::multi_index_container< SessionEntry, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag< IndexByID >, boost::multi_index::member< SessionEntry, EntityID, &SessionEntry::id > >, boost::multi_index::hashed_unique< boost::multi_index::tag< IndexByIP >, boost::multi_index::member< SessionEntry, boost::asio::ip::address, &SessionEntry::ip >, ip_address_hash > > > |
Enumerations | |
| enum | SocketError { NONE , FATAL , RETRY } |
| using Sessions = boost::multi_index_container< SessionEntry, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag<IndexByID>, boost::multi_index::member<SessionEntry, EntityID, &SessionEntry::id> >, boost::multi_index::hashed_unique< boost::multi_index::tag<IndexByIP>, boost::multi_index::member<SessionEntry, boost::asio::ip::address, &SessionEntry::ip>, ip_address_hash > > > |
This creates a data structure which allows us to query for a Session by either the id of the player associated with it, or by that player's tcp::endpoint information.
This stackoverflow post was helpful in understanding how to use boost::multi_index https://stackoverflow.com/questions/39510143/how-to-use-create-boostmulti-index
| enum SocketError |
Enumeration to classify different kinds of networking errors depending on the kind of action we should take. Note, we aren't currently classifying anything as RETRY. IF we find an error that we are treating as FATAL but should be RETRY, then we can use it.
| Enumerator | |
|---|---|
| NONE | No error, everything is good. |
| FATAL | We cannot recover from this error, so the socket is probably dead. |
| RETRY | There was an error, but it doesn't compromise the socket connection. |