TReplicationSlot
One game-installed callback slot, stored the only way a slot crossing a DLL boundary can be stored safely: a plain function pointer, an opaque context, and a release hook for the context.
- Module
- Networking
- Header
#include "Networking/Replication/ReplicationManager.h"- Namespace
Mowo- Template
template<typename FnT>
A std::function here was the ABI hazard — it is constructed by the installer (a hot-reloadable game module, a plugin, a test's frame) and destroyed by this class, in another image, through that image's allocator and its copy of the callable's inline destructor. It was also unattributable: with no address to test, a module unload had to wipe every slot on every manager, including the ones the dying module never touched.
All three pointers here are addresses in the INSTALLER's image. Construction and destruction of the context both happen there, and FModuleManager can say which module owns the slot.
Properties
| Type | Name | Description |
|---|---|---|
FnT | fn | Default nullptr. |
void* | context | Default nullptr. |
Public functions
| Returns | Name | Description |
|---|---|---|
void | ||
operatorbool | ||
void | Reset | |
void | Abandon | Drop the slot WITHOUT running the release hook. |
bool | OwnedBy | True when this module owns any of the three addresses, i.e. |
Function details
void
void (*release)(void* context) = nullptroperatorbool
explicit operator bool() constReset
void Reset()Abandon
void Abandon()Drop the slot WITHOUT running the release hook. Only for a module unload, where the hook itself lives in the pages about to be unmapped — leaking the context is the only available answer, and the image it was allocated from is going away with it.
OwnedBy
template<typename FOwns> bool OwnedBy(FOwns&& owns) constTrue when this module owns any of the three addresses, i.e. unloading it would leave the slot pointing into unmapped memory.