mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-11-16 07:48:07 +01:00
cleanup: get rid of unused states/actions and code to handle them.
This commit is contained in:
parent
1114784217
commit
9a2567252b
4 changed files with 0 additions and 78 deletions
|
@ -289,16 +289,6 @@ CookieRef::pushHeartFailedEvent( int socket )
|
|||
m_eventQueue.push_back( evt );
|
||||
}
|
||||
|
||||
void
|
||||
CookieRef::pushHeartTimerEvent( time_t now, vector<int>* victims )
|
||||
{
|
||||
CRefEvent evt;
|
||||
evt.type = XW_EVENT_HEARTTIMER;
|
||||
evt.u.htime.now = now;
|
||||
evt.u.htime.victims = victims;
|
||||
m_eventQueue.push_back( evt );
|
||||
}
|
||||
|
||||
void
|
||||
CookieRef::pushForwardEvent( HostID src, HostID dest,
|
||||
unsigned char* buf, int buflen )
|
||||
|
@ -420,10 +410,6 @@ CookieRef::handleEvents()
|
|||
noteHeartbeat( &evt );
|
||||
break;
|
||||
|
||||
case XW_ACTION_CHECKHEART:
|
||||
checkHeartbeats( &evt );
|
||||
break;
|
||||
|
||||
case XW_ACTION_NOTIFYDISCON:
|
||||
notifyDisconn( &evt );
|
||||
break;
|
||||
|
@ -432,7 +418,6 @@ CookieRef::handleEvents()
|
|||
removeSocket( &evt );
|
||||
break;
|
||||
|
||||
case XW_ACTION_HEARTOK:
|
||||
case XW_ACTION_NONE:
|
||||
/* nothing to do for these */
|
||||
break;
|
||||
|
@ -603,30 +588,6 @@ CookieRef::noteHeartbeat( const CRefEvent* evt )
|
|||
}
|
||||
} /* noteHeartbeat */
|
||||
|
||||
void
|
||||
CookieRef::checkHeartbeats( const CRefEvent* evt )
|
||||
{
|
||||
int vcount = 0;
|
||||
time_t now = evt->u.htime.now;
|
||||
|
||||
RWReadLock rwl( &m_sockets_rwlock );
|
||||
|
||||
map<HostID,HostRec>::iterator iter = m_hostSockets.begin();
|
||||
while ( iter != m_hostSockets.end() ) {
|
||||
time_t last = iter->second.m_lastHeartbeat;
|
||||
if ( (now - last) > GetHeartbeat() * 2 ) {
|
||||
pushHeartFailedEvent( iter->second.m_socket );
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
logf( "CookieRef::CheckHeartbeats done" );
|
||||
|
||||
/* Post an event */
|
||||
CRefEvent newEvt;
|
||||
newEvt.type = vcount > 0 ? XW_EVENT_HEARTFAILED : XW_EVENT_HEARTOK;
|
||||
m_eventQueue.push_back( newEvt );
|
||||
} /* checkHeartbeats */
|
||||
|
||||
/* timer callback */
|
||||
/* static */ void
|
||||
CookieRef::s_checkAllConnected( void* closure )
|
||||
|
|
|
@ -137,8 +137,6 @@ class CookieRef {
|
|||
void pushHeartbeatEvent( HostID id, int socket );
|
||||
void pushHeartFailedEvent( int socket );
|
||||
|
||||
|
||||
void pushHeartTimerEvent( time_t now, vector<int>* victims );
|
||||
void pushForwardEvent( HostID src, HostID dest, unsigned char* buf,
|
||||
int buflen );
|
||||
void pushDestBadEvent();
|
||||
|
@ -162,7 +160,6 @@ class CookieRef {
|
|||
|
||||
void disconnectSockets( int socket, XWREASON why );
|
||||
void noteHeartbeat(const CRefEvent* evt);
|
||||
void checkHeartbeats(const CRefEvent* evt);
|
||||
void notifyDisconn(const CRefEvent* evt);
|
||||
void removeSocket(const CRefEvent* evt);
|
||||
|
||||
|
|
|
@ -144,10 +144,6 @@ stateString( XW_RELAY_STATE state )
|
|||
CASESTR(XW_ST_CONNECTING);
|
||||
CASESTR(XW_ST_ALLCONNECTED);
|
||||
CASESTR(XW_ST_WAITING_RECON);
|
||||
CASESTR(XW_ST_SENDING_DISCON);
|
||||
CASESTR(XW_ST_DISCONNECTED);
|
||||
CASESTR(XW_ST_HEARTCHECK_CONNECTING);
|
||||
CASESTR(XW_ST_HEARTCHECK_CONNECTED);
|
||||
CASESTR(XW_ST_DEAD);
|
||||
CASESTR(XW_ST_CHECKING_CONN);
|
||||
CASESTR(XW_ST_CHECKINGDEST);
|
||||
|
@ -166,12 +162,8 @@ eventString( XW_RELAY_EVENT evt )
|
|||
CASESTR(XW_EVENT_RECONNECTMSG);
|
||||
CASESTR(XW_EVENT_FORWARDMSG);
|
||||
CASESTR(XW_EVENT_HEARTMSG);
|
||||
CASESTR(XW_EVENT_HEARTTIMER);
|
||||
CASESTR(XW_EVENT_DISCONTIMER);
|
||||
CASESTR(XW_EVENT_CONNTIMER);
|
||||
CASESTR(XW_EVENT_HEARTOK);
|
||||
CASESTR(XW_EVENT_HEARTFAILED);
|
||||
CASESTR(XW_EVENT_ALLHEREMSG);
|
||||
CASESTR(XW_EVENT_DESTOK);
|
||||
CASESTR(XW_EVENT_DESTBAD);
|
||||
CASESTR(XW_EVENT_CAN_LOCK);
|
||||
|
|
|
@ -48,16 +48,6 @@ typedef enum {
|
|||
all connections if we don't hear back from
|
||||
the missing guy soon. */
|
||||
|
||||
|
||||
,XW_ST_HEARTCHECK_CONNECTING /* In the middle of checking heartbeat situation. */
|
||||
,XW_ST_HEARTCHECK_CONNECTED /* Need two states so we know where to
|
||||
go back to. */
|
||||
|
||||
,XW_ST_SENDING_DISCON /* We're in the process of pulling the plug on
|
||||
all devices that remain connected. */
|
||||
|
||||
,XW_ST_DISCONNECTED /* We're about to kill this object. */
|
||||
|
||||
,XW_ST_CHECKINGDEST /* Checking for valid socket */
|
||||
|
||||
,XW_ST_CHECKING_CAN_LOCK /* Is this message one that implies all
|
||||
|
@ -81,21 +71,9 @@ typedef enum {
|
|||
|
||||
,XW_EVENT_HEARTMSG /* A heartbeat message arrived */
|
||||
|
||||
,XW_EVENT_HEARTTIMER /* Time to check for missing heartbeats */
|
||||
|
||||
,XW_EVENT_DISCONTIMER /* No reconnect received: time to kill the
|
||||
remaining connections */
|
||||
|
||||
,XW_EVENT_CONNTIMER /* timer for did we get all players hooked
|
||||
up */
|
||||
|
||||
,XW_EVENT_ALLHEREMSG /* message from server that all expected
|
||||
player reg messages have been received and
|
||||
no new hosts should be registering selvs
|
||||
with cookie. */
|
||||
|
||||
,XW_EVENT_HEARTOK
|
||||
|
||||
,XW_EVENT_DESTOK
|
||||
|
||||
,XW_EVENT_DESTBAD
|
||||
|
@ -127,14 +105,9 @@ typedef enum {
|
|||
|
||||
,XW_ACTION_NOTEHEART /* Record heartbeat received */
|
||||
|
||||
,XW_ACTION_CHECKHEART /* Check for heartbeats */
|
||||
|
||||
,XW_ACTION_DISCONNECTALL
|
||||
,XW_ACTION_TIMERDISCONNECT /* disconnect all because of a timer */
|
||||
|
||||
,XW_ACTION_HEARTOK /* allows transition back to stationary
|
||||
state */
|
||||
|
||||
,XW_ACTION_CHECKDEST /* check that a given hostID has a socket */
|
||||
|
||||
,XW_ACTION_NOTIFYDISCON
|
||||
|
@ -148,7 +121,6 @@ typedef enum {
|
|||
|
||||
} XW_RELAY_ACTION;
|
||||
|
||||
|
||||
int getFromTable( XW_RELAY_STATE curState, XW_RELAY_EVENT curEvent,
|
||||
XW_RELAY_ACTION* takeAction, XW_RELAY_STATE* nextState );
|
||||
|
||||
|
|
Loading…
Reference in a new issue