-
Notifications
You must be signed in to change notification settings - Fork 667
Description
Hi, before I make a pull request I'd like to ask here if this is something that you'd like to add to the library.
I was surprised to learn that there is no way to read acknowledgements for reliable messages. It's a feature we rely on for some of our replication systems. We could have let the receiver send another reliable message back for an ack, but I think that's a bit of a shame considering GNS already keeps track of acked segments. This is what we've done instead:
Inside SteamNetworkingMessage_t
we added m_cbSizeAcked
.
/// Size of the payload.
int m_cbSize;
// Size of the payload that has been acknowledged.
int m_cbSizeAcked;
We keep that variable up-to-date whenever segments are acked. On the game-side we supply a custom m_pfnFreeData
function and in there we check if the whole message has been acked.
bool acked = (pMsg->m_cbSize == pMsg->m_cbSizeAcked);
That way we get message acks for no extra costs.
This works great for us, but is this something you'd like to add to the actual library as well? If this is something you're interested in, I could make a pull request.
It can start simple like we did by adding the m_cbSizeAcked variable, and later it would be possible to make a new API to have callbacks instead of needing to override the m_pfnFreeData function.