+
+ const int msgnum = socket->m_msgnumber;
+ if ( msgnum )
+ {
+ // we need to remove any pending messages for this socket to avoid having
+ // them sent to a new socket which could reuse the same message number as
+ // soon as we destroy this one
+ MSG msg;
+ while ( ::PeekMessage(&msg, hWin, msgnum, msgnum, PM_REMOVE) )
+ ;
+
+ socketList[msgnum - WM_USER] = NULL;
+ }
+ //else: the socket has never been created successfully
+