[Vortex] vortex_connection_is_ok() bug?

Chris Yourch chris at replicus.com
Thu May 22 22:37:47 CEST 2008


I've got some more detail on the issue and a solution:

Vortex obviously knows the connection has died because the memory for the VortexConnection object has been freed when I call vortex_connection_is_ok() with it. So, how about adding a check for the validity of the memory block that the VortexConnection object is using within vortex_connection_is_ok()?  Or, add a new API function that checks the objects validity. Something like vortex_connection_is_object_valid() or vortex_connection_is_memory_valid()?

For checking the validity I would suggest adding a magic number to each instance of an object when constructed and resetting it to 0 when destructing it. To check the object, compare the object instances magic number to the actual magic number.

Another surefire check, at least under Windows, is to call _msize() with the pointer to the VortexConnection object and check that the returned size is consistent with a valid VortexConnection object.

Chris

________________________________
From: vortex-bounces at lists.aspl.es [mailto:vortex-bounces at lists.aspl.es] On Behalf Of Chris Yourch
Sent: Wednesday, May 21, 2008 3:50 PM
To: Vortex
Subject: [Vortex] vortex_connection_is_ok() bug?

I have a situation where 2 peers are connected, exchange some messages and then one of the peers goes down. When the still running peer attempts another connection with the peer it tries to reuse the VortexConnection object. But, before I reuse the VortexConnection object I pass it to vortex_connection_is_ok() and it returns true. Shouldn't vortex_connection_is_ok() return false?  Or, is there another way to ensure that a VortexConnection object is really valid?

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.aspl.es/pipermail/vortex/attachments/20080522/f5e1ca78/attachment.htm 


More information about the Vortex mailing list