Utility for processing, packing, queueing and sending of outbound edit messages. More...
#include <OctreeEditPacketSender.h>
Public Member Functions | |
void | queueOctreeEditMessage (PacketType type, QByteArray &editMessage) |
void | releaseQueuedMessages () |
virtual bool | process () override |
if you're running in non-threaded mode, you must call this method regularly More... | |
void | setMaxPendingMessages (int maxPendingMessages) |
Public Member Functions inherited from PacketSender | |
void | queuePacketForSending (const SharedNodePointer &destinationNode, std::unique_ptr< NLPacket > packet) |
Add packet to outbound queue. | |
bool | hasPacketsToSend () const |
are there packets waiting in the send queue to be sent | |
size_t | packetsToSendCount () const |
how many packets are there in the send queue waiting to be sent | |
void | setProcessCallIntervalHint (int usecsPerProcessCall) |
float | getLifetimePPS () const |
returns the packets per second send rate of this object over its lifetime | |
float | getLifetimeBPS () const |
returns the bytes per second send rate of this object over its lifetime | |
float | getLifetimePPSQueued () const |
returns the packets per second queued rate of this object over its lifetime | |
float | getLifetimeBPSQueued () const |
returns the bytes per second queued rate of this object over its lifetime | |
quint64 | getLifetimeInUsecs () const |
returns lifetime of this object from first packet sent to now in usecs | |
float | getLifetimeInSeconds () const |
returns lifetime of this object from first packet sent to now in usecs | |
quint64 | getLifetimePacketsSent () const |
returns the total packets sent by this object over its lifetime | |
quint64 | getLifetimeBytesSent () const |
returns the total bytes sent by this object over its lifetime | |
quint64 | getLifetimePacketsQueued () const |
returns the total packets queued by this object over its lifetime | |
quint64 | getLifetimeBytesQueued () const |
returns the total bytes queued by this object over its lifetime | |
Public Member Functions inherited from GenericThread | |
void | initialize (bool isThreaded=true, QThread::Priority priority=QThread::NormalPriority) |
void | terminate () |
Call to stop the thread. | |
Additional Inherited Members | |
Public Slots inherited from GenericThread | |
void | threadRoutine () |
If you're running in non-threaded mode, you must call this regularly. | |
Protected Member Functions inherited from GenericThread | |
void | lock () |
Locks all the resources of the thread. | |
void | unlock () |
Unlocks all the resources of the thread. | |
Utility for processing, packing, queueing and sending of outbound edit messages.
|
overridevirtual |
if you're running in non-threaded mode, you must call this method regularly
are we in sending mode. If we're not in sending mode then all packets and messages will be ignored and not queued and not sent set sending mode. By default we are set to shouldSend=TRUE and packets will be sent. If shouldSend=FALSE, then we'll switch to not sending mode, and all packets and messages will be ignored, not queued, and not sent. This might be used in an application like interface when all octree features are disabled.
Reimplemented from PacketSender.
void OctreeEditPacketSender::queueOctreeEditMessage | ( | PacketType | type, |
QByteArray & | editMessage | ||
) |
Queues a single edit message. Will potentially send a pending multi-command packet. Determines which server node or nodes the packet should be sent to. Can be called even before servers are known, in which case up to MaxPendingMessages will be buffered and processed when servers are known.
void OctreeEditPacketSender::releaseQueuedMessages | ( | ) |
Releases all queued messages even if those messages haven't filled an MTU packet. This will move the packed message packets onto the send queue. If running in threaded mode, the caller does not need to do any further processing to have these packets get sent. If running in non-threaded mode, the caller must still call process() on a regular interval to ensure that the packets are actually sent. Can be called even before servers are known, in which case up to MaxPendingMessages of the released messages will be buffered and actually released when servers are known.
|
inline |
Set the desired number of pending messages that the OctreeEditPacketSender should attempt to queue even if servers are not present. This only applies to how the OctreeEditPacketSender will manage messages when no servers are present. By default, this value is the same as the default packets that will be sent in one second. Which means the OctreeEditPacketSender will not buffer all messages given to it if no servers are present. This is the maximum number of queued messages and single messages.