[ENet-discuss] packet->referenceCount greater than zero (Lee Salzman)

Lee Salzman lsalzman1 at cox.net
Tue Mar 18 23:53:53 PDT 2008


The reference count is supposed to be greater than zero and under normal 
circumstances you don't free
packets you pass to enet_peer_send(), ENet does. You should never have 
to actually destroy the packet unless
you have sent the packet in error (i.e. to a disconnected peer or a 
non-existent channel).

Lee

Doug Kimzey wrote:
> Lee,
>
> That is what I am currently doing:
>
> 	enet_peer_send (..., packet);
> 	if (! packet -> referenceCount) enet_packet_destroy (packet);
>
> What I am finding is that after enet_peer_send is called (and returns zero - no error), packet->referenceCount is equal to the number of fragments sent to ::enet_peer_queue_outgoing_command(...).  
>
> So when enet_peer_send() returns, packet->referenceCount is always greater than zero and therefore, enet_packet_destroy( packet ) is not called.
>
> The packets almost always arrive at peer, however, the referenceCount is always greater than 0.
>
> Thank you,
> Doug Kimzey
>
>
>   


More information about the ENet-discuss mailing list