When the problem was found the solution was simple.

Set the OnDataAvailable event handler to nil before freeing the wrapping 
object.

rgs,

Merijn

Fastream Technologies wrote:
> Great job. Please tell us what your solution is as well.
>
> Best Regards,
>
> SZ
>
> On Tue, Apr 29, 2008 at 6:28 PM, Merijn Bosma <[EMAIL PROTECTED]> wrote:
>   
>> The mystery is solved :)
>>
>> On our server side we have a wrapping object per connected client, which
>> takes care of a few things, amongst which sending keep alives and timing
>> the connection out if needed.
>> If a timeout is detected, the wrapping object is freed, the clientside
>> drops the connection, and this cleans up the socket server-side as well.
>>
>> This all works well, except for a very occasional event, which could
>> happen when a client timed out and the wrapping object was freed (as
>> normal), and at that very moment a new client connected.
>> At this moment, it could happen that the memory manager instantiated the
>> wrapping object for the new client at exactly the same memory location
>> of the wrapping object which was just freed.
>> If at that moment, the socked of the previous client receive some data
>> before the connection was closed, it triggered it's OnDataAvailable
>> event, which was still set to the old wrapping object, but now of course
>> came out in the new wrapping object.
>> This caused a call to ReceiveStr() on the wrong TCustomWSocket, causing
>> the loop.
>>
>> it took a while to find, but it's finally solved.
>>
>> thanks for everybody thinking with me.
>>
>>
>> Francois PIETTE wrote:
>>     
>>>> I've looked for LSP, but didn't find anything, can you explain what you
>>>> mean with it?
>>>>
>>>>         
>>> http://www.microsoft.com/msj/0599/LayeredService/LayeredService.aspx
>>>
>>> --
>>> [EMAIL PROTECTED]
>>> The author of the freeware multi-tier middleware MidWare
>>> The author of the freeware Internet Component Suite (ICS)
>>> http://www.overbyte.be
>>>
>>>
>>>       
>> --
>> To unsubscribe or change your settings for TWSocket mailing list
>> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
>> Visit our website at http://www.overbyte.be
>>     

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to