don't bother pushing do-we-ack decision out of static method

This commit is contained in:
Eric House 2013-01-24 19:23:05 -08:00
parent 498498a2bf
commit 481e50aaae
2 changed files with 13 additions and 12 deletions

View file

@ -26,7 +26,13 @@ UDPAckTrack* UDPAckTrack::s_self = NULL;
/* static*/ uint32_t
UDPAckTrack::nextPacketID( XWRelayReg cmd )
{
return get()->nextPacketIDImpl( cmd );
uint32_t result;
if ( XWPDEV_ACK == cmd || XWPDEV_ALERT == cmd ) {
result = 0;
} else {
result = get()->nextPacketIDImpl();
}
return result;
}
/* static*/ void
@ -55,17 +61,12 @@ UDPAckTrack::UDPAckTrack()
}
uint32_t
UDPAckTrack::nextPacketIDImpl( XWRelayReg cmd )
UDPAckTrack::nextPacketIDImpl()
{
uint32_t result;
if ( XWPDEV_ACK == cmd || XWPDEV_ALERT == cmd ) {
result = 0;
} else {
MutexLock ml( &m_mutex );
AckRecord record;
result = ++m_nextID;
m_pendings.insert( pair<uint32_t,AckRecord>(result, record) );
}
MutexLock ml( &m_mutex );
AckRecord record;
uint32_t result = ++m_nextID;
m_pendings.insert( pair<uint32_t,AckRecord>(result, record) );
return result;
}

View file

@ -38,7 +38,7 @@ class UDPAckTrack {
static UDPAckTrack* get();
static void* thread_main( void* arg );
UDPAckTrack();
uint32_t nextPacketIDImpl( XWRelayReg cmd );
uint32_t nextPacketIDImpl();
void recordAckImpl( uint32_t packetID );
void* threadProc();