There is ConnectionManager
which waits for incoming connections. For each incoming connection it creates a Connection
instance which handles the inbound and outbound traffic on this connection. Each Connection
has a Watchdog
which handles "bad connection" conditions and calls registered "Listerners". One "Listener" is the ConnectionManager
which closes the connection and deletes the Connection
instance which in turn deletes the corresponding Watchdog.
Wait. A. Minute.
The Watchdog
calls the ConnectionManager
which deletes the Connection
which deletes the Watchdog
? The Watchdog chases its own tail.
I am completly blocked. How do I resolve this?
Solution: I will make the Listener thingy asynchronous, altough I don't know yet how to do that without too much pain. The Watchdog
doesn't know about the ConnectionManager
. It is fairly generic. Also the Win32-Thread-API doesn't have something like "join", so I might need to roll my own with GetExitCodeThread()
and STILL_ACTIVE
...
Thanks, guys.