Hi all,

I think I've encountered an issue in the message dispatch system which is used by wndcontrol.


What I'm doing is creating and destroying some sockets:

- socket 1 registers message 1043 as FMsg_WM_ASYNCSELECT (OverbyteICSWSocket:5696).
- this socket is free'd
- we start a server
- a client connects, so a new socket is instantiated (socket 2), which registers it's FMsgRelease message (OverbyteICSWndControl:562), and also gets 1043 for that message - now it seems we get a WM_ASYNCSELECT for socket 1 (which was already destroyed), which is now interpreted as WM_RELEASE for socket 2, so socket 2 is destroyed silently.

We can reproduce quite reliably with the following setup

- create any server (TWSocketServer.Create();), no need to listen, just instantiate
- create 5 sockets
- connect these sockets to 5 random ip's
- wait a few seconds
- destroy the 5 sockets
- start tcp server
- let a client connect.

The client will connect, and after approx 15 seconds it will drop, caused by the server dropping the socket due to above mentioned wrong interpreted WM_ASYNCSELECT

We have reproduced this with both latest V7 and latest V8.

If I'm not mistaken and this is really the case, _and_ it's not possible to stop the WM_ASYNCSELECT from being send to us after the socket is destroyed, this seems to be quite a nasty problem to solve, since TIcsWndHandler cannot distinguish if a received message was meant for socket 1 (which is already destroyed) or for socket 2 (which reuses the particular message id).

An option could be to not recycle the message id's as soon as they are available, but do a sort of circular buffer on them, hoping certiain messages will not be received until they are really used again, this doesn't feel like a proper solution though and in that case the problem could pop up again when more sockets are used.

Arno, (I think you came up with the message dispatch approach), I'm curious to your thoughts and hope you (or we) can think of a good way to tackle the problem.

tia,

Merijn Bosma


--
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