Now when someone disconnects the CConnection its freed from memory, this disconnection seems to cause the IOCP to complete immediately.  So the callback gets called again.  The problem I'm having is that the pOverlapped pointer seems to be valid however the pConnection pointer contains junk - ( I freed the memory it points to) , so when I try to 'Do Something' with the pointer it cause the first chance exception.  Now since the app doesn't crash and I only get a first chance exception I'm assuming that the OS catches it... 
Why don't you wait until the IOCP completion for disconnection is posted, and then free the connection object (or better yet, destroy it and return its memory to your memory pool to save an allocation for the next connection object)?
Man is something that must be overcome: and therefore you will love your virtues,- for you will perish by them.-
-Thus Spoke Zarathustra, F. W. Nietzsche

Reply via email to