mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
oops: still remove address from set tracked if it's not tcp
This commit is contained in:
parent
4ad6696ecc
commit
470dbb5304
2 changed files with 22 additions and 21 deletions
|
@ -419,14 +419,14 @@ CookieRef::removeSocket( const AddrInfo* addr )
|
||||||
{
|
{
|
||||||
RWWriteLock rwl( &m_socketsRWLock );
|
RWWriteLock rwl( &m_socketsRWLock );
|
||||||
vector<HostRec>::iterator iter;
|
vector<HostRec>::iterator iter;
|
||||||
for ( iter = m_sockets.begin(); !found && iter != m_sockets.end(); ++iter ) {
|
for ( iter = m_sockets.begin(); !found && iter != m_sockets.end();
|
||||||
|
++iter ) {
|
||||||
if ( iter->m_addr.equals( *addr ) ) {
|
if ( iter->m_addr.equals( *addr ) ) {
|
||||||
if ( iter->m_ackPending ) {
|
if ( iter->m_ackPending ) {
|
||||||
logf( XW_LOGINFO,
|
logf( XW_LOGINFO,
|
||||||
"%s: Never got ack; removing hid %d from DB",
|
"%s: Never got ack; removing hid %d from DB",
|
||||||
__func__, iter->m_hostID );
|
__func__, iter->m_hostID );
|
||||||
DBMgr::Get()->RmDeviceByHid( ConnName(),
|
DBMgr::Get()->RmDeviceByHid( ConnName(), iter->m_hostID );
|
||||||
iter->m_hostID );
|
|
||||||
m_nPlayersHere -= iter->m_nPlayersH;
|
m_nPlayersHere -= iter->m_nPlayersH;
|
||||||
cancelAckTimer( iter->m_hostID );
|
cancelAckTimer( iter->m_hostID );
|
||||||
}
|
}
|
||||||
|
@ -831,7 +831,7 @@ CookieRef::send_with_length( const AddrInfo* addr, HostID dest,
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( failed && cascade && addr->isTCP() ) {
|
if ( failed && cascade ) {
|
||||||
pushRemoveSocketEvent( addr );
|
pushRemoveSocketEvent( addr );
|
||||||
XWThreadPool::GetTPool()->CloseSocket( addr );
|
XWThreadPool::GetTPool()->CloseSocket( addr );
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,26 +173,27 @@ XWThreadPool::RemoveSocket( const AddrInfo* addr )
|
||||||
void
|
void
|
||||||
XWThreadPool::CloseSocket( const AddrInfo* addr )
|
XWThreadPool::CloseSocket( const AddrInfo* addr )
|
||||||
{
|
{
|
||||||
assert( addr->isTCP() );
|
if ( addr->isTCP() ) {
|
||||||
if ( !RemoveSocket( addr ) ) {
|
if ( !RemoveSocket( addr ) ) {
|
||||||
MutexLock ml( &m_queueMutex );
|
MutexLock ml( &m_queueMutex );
|
||||||
deque<QueuePr>::iterator iter = m_queue.begin();
|
deque<QueuePr>::iterator iter = m_queue.begin();
|
||||||
while ( iter != m_queue.end() ) {
|
while ( iter != m_queue.end() ) {
|
||||||
if ( iter->m_info.m_addr.equals( *addr ) ) {
|
if ( iter->m_info.m_addr.equals( *addr ) ) {
|
||||||
m_queue.erase( iter );
|
m_queue.erase( iter );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
++iter;
|
|
||||||
}
|
}
|
||||||
}
|
logf( XW_LOGINFO, "CLOSING socket %d", addr->socket() );
|
||||||
logf( XW_LOGINFO, "CLOSING socket %d", addr->socket() );
|
close( addr->socket() );
|
||||||
close( addr->socket() );
|
|
||||||
|
|
||||||
/* We always need to interrupt the poll because the socket we're closing
|
/* We always need to interrupt the poll because the socket we're closing
|
||||||
will be in the list being listened to. That or we need to drop sockets
|
will be in the list being listened to. That or we need to drop sockets
|
||||||
that have been removed on some other thread while the poll call's
|
that have been removed on some other thread while the poll call's
|
||||||
blocking.*/
|
blocking.*/
|
||||||
interrupt_poll();
|
interrupt_poll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Reference in a new issue