mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
Ignore async responses if handles don't match to drop outdated
requests.
This commit is contained in:
parent
fab5aff8ad
commit
9f7b5e077c
1 changed files with 16 additions and 11 deletions
|
@ -256,6 +256,7 @@ getHostAddr( CeSocketWrapper* self )
|
|||
if ( self->addrRec.u.ip_relay.hostName[0] ) {
|
||||
XP_LOGF( "%s: calling WSAAsyncGetHostByName(%s)",
|
||||
__func__, self->addrRec.u.ip_relay.hostName );
|
||||
XP_ASSERT( !self->getHostTask );
|
||||
self->getHostTask
|
||||
= WSAAsyncGetHostByName( self->hWnd,
|
||||
XWWM_HOSTNAME_ARRIVED,
|
||||
|
@ -313,7 +314,9 @@ ce_sockwrap_hostname( CeSocketWrapper* self, WPARAM XP_UNUSED_DBG(wParam),
|
|||
XP_ASSERT( CE_IPST_RESOLVINGHOST == self->connState );
|
||||
|
||||
if ( 0 == err ) {
|
||||
XP_ASSERT( (HANDLE)wParam == self->getHostTask );
|
||||
if ( (HANDLE)wParam != self->getHostTask ) {
|
||||
XP_LOGF( "%s: ignoring old event", __func__ );
|
||||
} else {
|
||||
|
||||
XP_U32 tmp;
|
||||
XP_MEMCPY( &tmp, &self->hostNameUnion.hent.h_addr_list[0][0],
|
||||
|
@ -327,6 +330,8 @@ ce_sockwrap_hostname( CeSocketWrapper* self, WPARAM XP_UNUSED_DBG(wParam),
|
|||
(int)((tmp>>24) & 0xFF) );
|
||||
|
||||
stateChanged( self, CE_IPST_HOSTRESOLVED );
|
||||
self->getHostTask = NULL;
|
||||
}
|
||||
} else {
|
||||
XP_LOGF( "%s: async operation failed: %ld", __func__, err );
|
||||
/* WSAENETDOWN */
|
||||
|
|
Loading…
Reference in a new issue