![]() |
vkmEngine 1.0.15
A C++ game engine · vkmengine.com
|
The sending half of messages that must arrive: once each, in the order sent. More...
#include <messages.h>
Public Member Functions | |
| bool | push (const uint8_t *bytes, size_t size) |
Keep size bytes to send. | |
| size_t | write (BitWriter &out, size_t budgetBits) const |
Write the oldest messages kept that fit in budgetBits. | |
| void | acknowledge (uint16_t newest) |
The other end has every message up to newest: stop sending them. | |
| size_t | pending () const |
| Messages waiting to be acknowledged. | |
| void | clear () |
| Forget every message, and number the next one from the start. | |
Static Public Attributes | |
| static constexpr uint32_t | NONE_BITS = 1 |
| What write() writes when no message fits: the bit saying none follow. | |
The sending half of messages that must arrive: once each, in the order sent.
A message is numbered and kept until the other end says it has it. Every packet carries every message still kept that fits, oldest first - the commands' answer to loss, not a retransmit timer - so a message rides each packet sent until one arrives, and the receiver drops the copies it already has.
| bool Vkm::Engine::NetOutbox::push | ( | const uint8_t * | bytes, |
| size_t | size ) |
Keep size bytes to send.
| bytes | The message. |
| size | Its length, 1 to NET_MESSAGE_MAX_BYTES. |
| size_t Vkm::Engine::NetOutbox::write | ( | BitWriter & | out, |
| size_t | budgetBits ) const |
Write the oldest messages kept that fit in budgetBits.
Always at least the one bit saying whether any follow.
| out | The packet. |
| budgetBits | Room left in it. |
| void Vkm::Engine::NetOutbox::acknowledge | ( | uint16_t | newest | ) |
The other end has every message up to newest: stop sending them.
| newest | The latest sequence it has, as its acknowledgement says. |