Closed xale closed 14 years ago
This may be possible to fix (or at least debug) by passing to the function in question the CFStreamRef given as an argument to the callback, rather than the NULLed pointer from the AsyncSocket object.
Since this is proving difficult to replicate, I am tempted to solve it with some modifications to the AsyncSocket implementation that appear to be justifiable from a defensive-coding standpoint, regardless of whether this bug continues to occur.
Haven't been able to replicate for a while, but should be fixed by bb6db7d9f9cea52dc3eba5496de8a65b1b7c030f anyway.
If the user cancels a connection in progress after the socket has already opened, everything appears to disconnect properly, but the app crashes a little while later, in a callback within the AsyncSocket implementation. What appears to be happening is that the AsyncSocket object releases and NULLs its references to the CFStreams, but at least one is not deallocated, and later calls back with an error to be handled. This triggers the AsyncSocket code to call a function on a NULLed CFStream reference, which causes the crash.