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

Doug Kimzey doug.kimzey at dpra.com
Wed Mar 19 15:08:06 PDT 2008


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



-----Original Message-----
From: enet-discuss-bounces at cubik.org [mailto:enet-discuss-bounces at cubik.org] On Behalf Of enet-discuss-request at cubik.org
Sent: Wednesday, March 19, 2008 3:00 PM
To: enet-discuss at cubik.org
Subject: ENet-discuss Digest, Vol 58, Issue 12

Send ENet-discuss mailing list submissions to
	enet-discuss at cubik.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://lists.cubik.org/mailman/listinfo/enet-discuss
or, via email, send a message with subject or body 'help' to
	enet-discuss-request at cubik.org

You can reach the person managing the list at
	enet-discuss-owner at cubik.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ENet-discuss digest..."


Today's Topics:

   1. Re:  how to know when it's safe to	call enet_peer_send
      (Ruud van Gaal)
   2.  packet->referenceCount greater than zero (Doug Kimzey)
   3. Re:  packet->referenceCount greater than zero (Lee Salzman)
   4. Re:  packet->referenceCount greater than zero (Marc Rochel)


----------------------------------------------------------------------

Message: 1
Date: Tue, 18 Mar 2008 22:51:25 +0100
From: "Ruud van Gaal" <ruud at racer.nl>
Subject: Re: [ENet-discuss] how to know when it's safe to	call
	enet_peer_send
To: <enet-discuss at cubik.org>
Message-ID: <200803182151.m2ILpT8B003049 at bellevue.puremagic.com>
Content-Type: text/plain;	charset="us-ascii"

It seems you may want to change ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE, although
I'm not sure what it does. :)

I have had similar problems where I wanted to modify disconnect timeouts.
I've modified the source so I can change ENET_PEER_TIMEOUT_MINIMUM and
ENET_PEER_TIMEOUT_MAXIMUM to the applications preference. In one app (a
lobby server) the short timeouts are ok, but for another app (LAN-based)
there can be delays of ~30s in calling enet).

Is it an idea (Lee?) to put most of those tuning settings in an ENetPrefs
structure so you can modify them before initializing Enet? It seems for GPRS
for example you'll need slightly tuned settings.

Cheers,
Ruud

> Date: Tue, 18 Mar 2008 00:25:50 +0300
> From: eye at dihalt.com
> Subject: Re: [ENet-discuss] how to know when it's safe to	call
> 	enet_peer_send()?
> To: Discussion of the ENet library <enet-discuss at cubik.org>
> Message-ID: <web-3357404 at backend14.aha.ru>
> Content-Type: text/plain; charset="ISO-8859-1"
> 
> I have just tested the code. There is a little problem:
> peer->windowsSize is a constant value of
> ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE (32768) if network speed is 
> not set. And i can't set or test network speed for end-user 
> programs - speed can be very different each minute. 32768 is 
> a big value. On slow GPRS networks and medium size packets 
> (~1k) sending 32768/1024 = 32 packets will surely lead to ACK 
> timeout :(.



------------------------------

Message: 2
Date: Wed, 19 Mar 2008 08:34:03 -0500
From: "Doug Kimzey" <doug.kimzey at dpra.com>
Subject: [ENet-discuss] packet->referenceCount greater than zero
To: <enet-discuss at cubik.org>
Message-ID:
	<7C8AC1F7C17EE443B67D841A5F3B067601D3265A at knx-ex1.ad.dpra.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

 

I have been troubleshooting a memory leak in my application that uses
eNet.  I suspect that we need to do some cleanup on sent packets but
would like some guidance - (so please correct me where I am wrong).

 

*         Packets are usually only destroyed when the
_ENetPacket::referenceCount field is equal to 0

*         In walking through my code:

o   A packet is successfully created - and the newly created packet has
a referenceCount of 0

o   ::enet_peer_send(...) queues the packet fragments when the packet
size exceeds the fragment length.  For each fragment in the packet,
::enet_peer_queue_outgoing_command(...) is called.

o   In ::enet_peer_queue_outgoing_command(...):

 

*         An ENetOutgoingCommand is allocated and initialized

*         The packet->referenceCount is incremented.

o   ::enet_peer_send returns 0 (success)

o   My packet->referenceCount is greater than 0 - so my call to
::enet_packet_destroy(...) is not made and the packet memory is not
freed.

 

Is there an enet function that should be called after ::enet_peer_send
that will verify the packet was indeed sent and decrement the
packet->referenceCount before calling ::enet_packet_destroy?

 

Thank you,

Doug Kimzey

Doug.kimzey at dpra.com

DPRA, Inc.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cubik.org/pipermail/enet-discuss/attachments/20080319/d592d3c7/attachment.html 

------------------------------

Message: 3
Date: Tue, 18 Mar 2008 15:57:56 -0700
From: Lee Salzman <lsalzman1 at cox.net>
Subject: Re: [ENet-discuss] packet->referenceCount greater than zero
To: Discussion of the ENet library <enet-discuss at cubik.org>
Message-ID: <47E048F4.2000409 at cox.net>
Content-Type: text/plain; charset=windows-1252; format=flowed

enet_peer_send (..., packet);
if (! packet -> referenceCount) enet_packet_destroy (packet);

Doug Kimzey wrote:
>
> Hello,
>
> I have been troubleshooting a memory leak in my application that uses 
> eNet. I suspect that we need to do some cleanup on sent packets but 
> would like some guidance ? (so please correct me where I am wrong).
>
> · Packets are usually only destroyed when the 
> _ENetPacket::referenceCount field is equal to 0
>
> · In walking through my code:
>
> o A packet is successfully created ? and the newly created packet has 
> a referenceCount of 0
>
> o ::enet_peer_send(?) queues the packet fragments when the packet size 
> exceeds the fragment length. For each fragment in the packet, 
> ::enet_peer_queue_outgoing_command(?) is called.
>
> o In ::enet_peer_queue_outgoing_command(?):
>
> · An ENetOutgoingCommand is allocated and initialized
>
> · The packet->referenceCount is incremented.
>
> o ::enet_peer_send returns 0 (success)
>
> o My packet->referenceCount is greater than 0 ? so my call to 
> ::enet_packet_destroy(?) is not made and the packet memory is not freed.
>
> Is there an enet function that should be called after ::enet_peer_send 
> that will verify the packet was indeed sent and decrement the 
> packet->referenceCount before calling ::enet_packet_destroy?
>
> Thank you,
>
> Doug Kimzey
>
> Doug.kimzey at dpra.com
>
> DPRA, Inc.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>   



------------------------------

Message: 4
Date: Wed, 19 Mar 2008 18:17:53 +0100
From: "Marc Rochel" <marc.rochel at udicom.de>
Subject: Re: [ENet-discuss] packet->referenceCount greater than zero
To: "Discussion of the ENet library" <enet-discuss at cubik.org>
Message-ID: <E9BC41701AC6E74E906356F37D60B98E2291AF at owa.udicom.de>
Content-Type: text/plain; charset="iso-8859-1"

Hi !

Now I'm surprised. I never did that before. Do we have to add that line

if (! packet -> referenceCount) enet_packet_destroy (packet);

always after 

enet_peer_send (..., packet);

? I always just did the enet_peer_send and nothing more.

Best regards
  Marc
 

-----Ursprüngliche Nachricht-----
Von: enet-discuss-bounces at cubik.org [mailto:enet-discuss-bounces at cubik.org]
Im Auftrag von Lee Salzman
Gesendet: Dienstag, 18. März 2008 23:58
An: Discussion of the ENet library
Betreff: Re: [ENet-discuss] packet->referenceCount greater than zero

enet_peer_send (..., packet);
if (! packet -> referenceCount) enet_packet_destroy (packet);

Doug Kimzey wrote:
>
> Hello,
>
> I have been troubleshooting a memory leak in my application that uses 
> eNet. I suspect that we need to do some cleanup on sent packets but 
> would like some guidance - (so please correct me where I am wrong).
>
> · Packets are usually only destroyed when the 
> _ENetPacket::referenceCount field is equal to 0
>
> · In walking through my code:
>
> o A packet is successfully created - and the newly created packet has 
> a referenceCount of 0
>
> o ::enet_peer_send(...) queues the packet fragments when the packet size 
> exceeds the fragment length. For each fragment in the packet,
> ::enet_peer_queue_outgoing_command(...) is called.
>
> o In ::enet_peer_queue_outgoing_command(...):
>
> · An ENetOutgoingCommand is allocated and initialized
>
> · The packet->referenceCount is incremented.
>
> o ::enet_peer_send returns 0 (success)
>
> o My packet->referenceCount is greater than 0 - so my call to
> ::enet_packet_destroy(...) is not made and the packet memory is not freed.
>
> Is there an enet function that should be called after ::enet_peer_send 
> that will verify the packet was indeed sent and decrement the
> packet->referenceCount before calling ::enet_packet_destroy?
>
> Thank you,
>
> Doug Kimzey
>
> Doug.kimzey at dpra.com
>
> DPRA, Inc.
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>   

_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org
http://lists.cubik.org/mailman/listinfo/enet-discuss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3166 bytes
Desc: not available
Url : http://lists.cubik.org/pipermail/enet-discuss/attachments/20080319/43190f85/attachment-0001.bin 

------------------------------

_______________________________________________
ENet-discuss mailing list
ENet-discuss at cubik.org
http://lists.cubik.org/mailman/listinfo/enet-discuss


End of ENet-discuss Digest, Vol 58, Issue 12
********************************************



More information about the ENet-discuss mailing list