#include <FullyConnectedMesh2.h>
Public Member Functions | |
void | SetConnectOnNewRemoteConnection (bool attemptConnection, RakNet::RakString pw) |
RakNetGUID | GetConnectedHost (void) const |
The connected host is whichever system we are connected to that has been running the longest. | |
RakNetGUID | GetHostSystem (void) const |
bool | IsHostSystem (void) const |
bool | IsConnectedHost (void) const |
void | SetAutoparticipateConnections (bool b) |
Automatically add new connections to the fully connected mesh. | |
void | ResetHostCalculation (void) |
Clear our own host order, and recalculate as if we had just reconnected. | |
void | AddParticipant (RakNetGUID rakNetGuid) |
if SetAutoparticipateConnections() is called with false, then you need to use AddParticipant before these systems will be added to the mesh | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | OnRakPeerStartup (void) |
Called when RakPeer is initialized. | |
virtual void | OnAttach (void) |
virtual void | OnRakPeerShutdown (void) |
Called when RakPeer is shutdown. | |
virtual void | OnClosedConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
virtual void | OnNewConnection (SystemAddress systemAddress, RakNetGUID rakNetGUID, bool isIncoming) |
Protected Attributes | |
DataStructures::List < FCM2Participant > | participantList |
List of systems we know the FCM2Guid for. |
This will connect RakPeer to all connecting peers, and all peers the connecting peer knows about.
It will also calculate which system has been running longest, to find out who should be host, if you need one system to act as a host
void FullyConnectedMesh2::AddParticipant | ( | RakNetGUID | rakNetGuid | ) |
if SetAutoparticipateConnections() is called with false, then you need to use AddParticipant before these systems will be added to the mesh
[in] | participant | The new participant |
RakNetGUID FullyConnectedMesh2::GetConnectedHost | ( | void | ) | const |
The connected host is whichever system we are connected to that has been running the longest.
Will return UNASSIGNED_RAKNET_GUID if we are not connected to anyone, or if we are connected and are calculating the host If includeCalculating is true, will return the estimated calculated host as long as the calculation is nearly complete includeCalculating should be true if you are taking action based on another system becoming host, because not all host calculations may compelte at the exact same time
RakNetGUID FullyConnectedMesh2::GetHostSystem | ( | void | ) | const |
bool FullyConnectedMesh2::IsConnectedHost | ( | void | ) | const |
[in] | includeCalculating | If true, and we are currently calculating a new host, return the new host if the calculation is nearly complete |
bool FullyConnectedMesh2::IsHostSystem | ( | void | ) | const |
virtual void FullyConnectedMesh2::OnAttach | ( | void | ) | [virtual] |
Called when the interface is attached
[in] | peer | the instance of RakPeer that is calling Receive |
Reimplemented from PluginInterface2.
virtual void FullyConnectedMesh2::OnClosedConnection | ( | SystemAddress | systemAddress, | |
RakNetGUID | rakNetGUID, | |||
PI2_LostConnectionReason | lostConnectionReason | |||
) | [virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
[in] | systemAddress | The system whose connection was closed |
[in] | rakNetGuid | The guid of the specified system |
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection |
Reimplemented from PluginInterface2.
virtual void FullyConnectedMesh2::OnNewConnection | ( | SystemAddress | systemAddress, | |
RakNetGUID | rakNetGUID, | |||
bool | isIncoming | |||
) | [virtual] |
Called when we got a new connection
[in] | systemAddress | Address of the new connection |
[in] | rakNetGuid | The guid of the specified system |
[in] | isIncoming | If true, this is ID_NEW_INCOMING_CONNECTION, or the equivalent |
Reimplemented from PluginInterface2.
virtual PluginReceiveResult FullyConnectedMesh2::OnReceive | ( | Packet * | packet | ) | [virtual] |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from PluginInterface2.
void FullyConnectedMesh2::SetAutoparticipateConnections | ( | bool | b | ) |
Automatically add new connections to the fully connected mesh.
Defaults to true.
[in] | b | As stated |
void FullyConnectedMesh2::SetConnectOnNewRemoteConnection | ( | bool | attemptConnection, | |
RakNet::RakString | pw | |||
) |
When the message ID_REMOTE_NEW_INCOMING_CONNECTION arrives, we try to connect to that system
[in] | attemptConnection | If true, we try to connect to any systems we are notified about with ID_REMOTE_NEW_INCOMING_CONNECTION, which comes from the ConnectionGraph2 plugin. Defaults to true. |
[in] | pw | The password to use to connect with. Only used if attemptConnection is true |