mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
variable/method name change only: cookieid->cid
This commit is contained in:
parent
38ad3aa81c
commit
cdc16ee974
4 changed files with 36 additions and 36 deletions
|
@ -85,7 +85,7 @@ CookieRef::ReInit( const char* cookie, const char* connName, CookieID id,
|
|||
{
|
||||
m_cookie = cookie==NULL?"":cookie;
|
||||
m_connName = connName==NULL?"":connName;
|
||||
m_cookieID = id;
|
||||
m_cid = id;
|
||||
m_curState = XWS_EMPTY;
|
||||
m_nPlayersSought = nPlayers;
|
||||
m_nPlayersHere = nAlreadyHere;
|
||||
|
@ -120,7 +120,7 @@ CookieRef::CookieRef( const char* cookie, const char* connName, CookieID id,
|
|||
|
||||
CookieRef::~CookieRef()
|
||||
{
|
||||
logf( XW_LOGINFO, "CookieRef for %d being deleted", m_cookieID );
|
||||
logf( XW_LOGINFO, "CookieRef for %d being deleted", m_cid );
|
||||
cancelAllConnectedTimer();
|
||||
|
||||
/* get rid of any sockets still contained */
|
||||
|
@ -146,7 +146,7 @@ CookieRef::Clear(void)
|
|||
{
|
||||
m_cookie = "";
|
||||
m_connName = "";
|
||||
m_cookieID = 0;
|
||||
m_cid = 0;
|
||||
m_eventQueue.clear();
|
||||
} /* Clear */
|
||||
|
||||
|
@ -999,7 +999,7 @@ CookieRef::sendResponse( const CRefEvent* evt, bool initial )
|
|||
|
||||
*bufp++ = initial ? XWRELAY_CONNECT_RESP : XWRELAY_RECONNECT_RESP;
|
||||
*bufp++ = evt->u.con.srcID;
|
||||
putNetShort( &bufp, GetCookieID() );
|
||||
putNetShort( &bufp, GetCid() );
|
||||
putNetShort( &bufp, GetHeartbeat() );
|
||||
int nTotal, nHere;
|
||||
DBMgr::Get()->GetPlayerCounts( ConnName(), &nTotal, &nHere );
|
||||
|
@ -1265,7 +1265,7 @@ CookieRef::s_checkAllConnected( void* closure )
|
|||
{
|
||||
/* Need to ensure */
|
||||
CookieRef* self = (CookieRef*)closure;
|
||||
SafeCref scr(self->GetCookieID(), false );
|
||||
SafeCref scr(self->GetCid(), false );
|
||||
scr.CheckAllConnected();
|
||||
}
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ CookieRef::s_checkAck( void* closure )
|
|||
CookieRef* self = at->m_this;
|
||||
if ( NULL != self ) {
|
||||
at->m_this = NULL;
|
||||
SafeCref scr(self->GetCookieID(), false );
|
||||
SafeCref scr(self->GetCid(), false );
|
||||
scr.CheckNotAcked( at->m_hid );
|
||||
}
|
||||
}
|
||||
|
@ -1324,7 +1324,7 @@ CookieRef::logf( XW_LogLevel level, const char* format, ... )
|
|||
char buf[256];
|
||||
int len;
|
||||
|
||||
len = snprintf( buf, sizeof(buf), "cid:%d ", m_cookieID );
|
||||
len = snprintf( buf, sizeof(buf), "cid:%d ", m_cid );
|
||||
|
||||
va_list ap;
|
||||
va_start( ap, format );
|
||||
|
@ -1346,7 +1346,7 @@ CookieRef::_PrintCookieInfo( string& out )
|
|||
snprintf( buf, sizeof(buf), "%s\n", ConnName() );
|
||||
out += buf;
|
||||
|
||||
snprintf( buf, sizeof(buf), "id=%d\n", GetCookieID() );
|
||||
snprintf( buf, sizeof(buf), "id=%d\n", GetCid() );
|
||||
out += buf;
|
||||
|
||||
snprintf( buf, sizeof(buf), "Total players=%d\n", m_nPlayersSought );
|
||||
|
|
|
@ -87,7 +87,7 @@ class CookieRef {
|
|||
|
||||
/* Within this cookie, remember that this hostID and socket go together.
|
||||
If the hostID is HOST_ID_SERVER, it's the server. */
|
||||
CookieID GetCookieID() { return m_cookieID; }
|
||||
CookieID GetCid() { return m_cid; }
|
||||
int GetPlayersSought() { return m_nPlayersSought; }
|
||||
int GetPlayersHere() { return m_nPlayersHere; }
|
||||
|
||||
|
@ -246,7 +246,7 @@ class CookieRef {
|
|||
time_t GetStarttime( void ) { return m_starttime; }
|
||||
int GetLangCode( void ) { return m_langCode; }
|
||||
|
||||
bool notInUse(void) { return m_cookieID == 0; }
|
||||
bool notInUse(void) { return m_cid == 0; }
|
||||
|
||||
void store_message( HostID dest, const unsigned char* buf,
|
||||
unsigned int len );
|
||||
|
@ -267,7 +267,7 @@ class CookieRef {
|
|||
int m_heatbeat; /* might change per carrier or something. */
|
||||
string m_cookie; /* cookie used for initial connections */
|
||||
string m_connName; /* globally unique name */
|
||||
CookieID m_cookieID; /* Unique among current games on this server */
|
||||
CookieID m_cid; /* Unique among current games on this server */
|
||||
|
||||
XW_RELAY_STATE m_curState;
|
||||
deque<CRefEvent> m_eventQueue;
|
||||
|
|
|
@ -95,7 +95,7 @@ CRefMgr::CloseAll()
|
|||
}
|
||||
cref = iter->second;
|
||||
{
|
||||
SafeCref scr( cref->GetCookieID(), false ); /* cref */
|
||||
SafeCref scr( cref->GetCid(), false ); /* cref */
|
||||
scr.Shutdown();
|
||||
}
|
||||
}
|
||||
|
@ -157,14 +157,14 @@ CRefMgr::GetStats( CrefMgrInfo& mgrInfo )
|
|||
CrefInfo info;
|
||||
info.m_cookie = cref->Cookie();
|
||||
info.m_connName = cref->ConnName();
|
||||
info.m_cookieID = cref->GetCookieID();
|
||||
info.m_cookieID = cref->GetCid();
|
||||
info.m_curState = cref->CurState();
|
||||
info.m_nPlayersSought = cref->GetPlayersSought();
|
||||
info.m_nPlayersHere = cref->GetPlayersHere();
|
||||
info.m_startTime = cref->GetStarttime();
|
||||
info.m_langCode = cref->GetLangCode();
|
||||
|
||||
SafeCref sc(cref->GetCookieID(), false );
|
||||
SafeCref sc(cref->GetCid(), false );
|
||||
sc.GetHostsConnected( &info.m_hostsIds, &info.m_hostSeeds,
|
||||
&info.m_hostIps );
|
||||
|
||||
|
@ -452,9 +452,9 @@ CRefMgr::AddNew( const char* cookie, const char* connName, CookieID cid,
|
|||
|
||||
ref->assignConnName();
|
||||
|
||||
m_cookieMap.insert( pair<CookieID, CookieRef*>(ref->GetCookieID(), ref ) );
|
||||
m_cookieMap.insert( pair<CookieID, CookieRef*>(ref->GetCid(), ref ) );
|
||||
logf( XW_LOGINFO, "%s: paired cookie %s/connName %s with cid %d", __func__,
|
||||
(cookie?cookie:"NULL"), connName, ref->GetCookieID() );
|
||||
(cookie?cookie:"NULL"), connName, ref->GetCid() );
|
||||
|
||||
#ifdef RELAY_HEARTBEAT
|
||||
if ( m_cookieMap.size() == 1 ) {
|
||||
|
@ -474,7 +474,7 @@ void
|
|||
CRefMgr::Recycle_locked( CookieRef* cref )
|
||||
{
|
||||
logf( XW_LOGINFO, "%s(cref=%p,cookie=%s)", __func__, cref, cref->Cookie() );
|
||||
CookieID id = cref->GetCookieID();
|
||||
CookieID id = cref->GetCid();
|
||||
DBMgr::Get()->ClearCID( cref->ConnName() );
|
||||
cref->Clear();
|
||||
addToFreeList( cref );
|
||||
|
@ -571,7 +571,7 @@ CookieMapIterator::Next()
|
|||
CookieID id = 0;
|
||||
if ( _iter != CRefMgr::Get()->m_cookieMap.end() ) {
|
||||
CookieRef* cref = _iter->second;
|
||||
id = cref->GetCookieID();
|
||||
id = cref->GetCid();
|
||||
++_iter;
|
||||
}
|
||||
return id;
|
||||
|
@ -621,7 +621,7 @@ SafeCref::SafeCref( const char* connName, const char* cookie, HostID hid,
|
|||
nPlayersS, gameSeed, langCode,
|
||||
wantsPublic || makePublic, &isDead );
|
||||
if ( cinfo != NULL ) {
|
||||
assert( cinfo->GetCid() == cinfo->GetRef()->GetCookieID() );
|
||||
assert( cinfo->GetCid() == cinfo->GetRef()->GetCid() );
|
||||
m_locked = cinfo->GetRef()->Lock();
|
||||
m_cinfo = cinfo;
|
||||
m_isValid = true;
|
||||
|
@ -638,7 +638,7 @@ SafeCref::SafeCref( const char* const connName )
|
|||
bool isDead = false;
|
||||
CidInfo* cinfo = m_mgr->getMakeCookieRef( connName, &isDead );
|
||||
if ( cinfo != NULL ) {
|
||||
assert( cinfo->GetCid() == cinfo->GetRef()->GetCookieID() );
|
||||
assert( cinfo->GetCid() == cinfo->GetRef()->GetCid() );
|
||||
m_locked = cinfo->GetRef()->Lock();
|
||||
m_cinfo = cinfo;
|
||||
m_isValid = true;
|
||||
|
@ -654,9 +654,9 @@ SafeCref::SafeCref( CookieID connID, bool failOk )
|
|||
CidInfo* cinfo = m_mgr->getCookieRef( connID );
|
||||
if ( cinfo != NULL ) { /* known cookie? */
|
||||
CookieRef* cref = cinfo->GetRef();
|
||||
assert( cinfo->GetCid() == cref->GetCookieID() );
|
||||
assert( cinfo->GetCid() == cref->GetCid() );
|
||||
m_locked = cref->Lock();
|
||||
m_isValid = m_locked && connID == cref->GetCookieID();
|
||||
m_isValid = m_locked && connID == cref->GetCid();
|
||||
m_cinfo = cinfo;
|
||||
}
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ SafeCref::SafeCref( int socket )
|
|||
CidInfo* cinfo = m_mgr->getCookieRef( socket );
|
||||
if ( cinfo != NULL ) { /* known socket? */
|
||||
CookieRef* cref = cinfo->GetRef();
|
||||
assert( cinfo->GetCid() == cref->GetCookieID() );
|
||||
assert( cinfo->GetCid() == cref->GetCid() );
|
||||
m_locked = cref->Lock();
|
||||
m_isValid = m_locked && cref->HasSocket_locked( socket );
|
||||
m_cinfo = cinfo;
|
||||
|
@ -682,7 +682,7 @@ SafeCref::~SafeCref()
|
|||
bool recycle = false;
|
||||
if ( m_locked ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( m_cinfo->GetCid() == cref->GetCookieID() );
|
||||
assert( m_cinfo->GetCid() == cref->GetCid() );
|
||||
recycle = cref->ShouldDie();
|
||||
if ( recycle ) {
|
||||
m_mgr->Recycle_locked( cref );
|
||||
|
|
|
@ -188,7 +188,7 @@ class SafeCref {
|
|||
bool Forward( HostID src, HostID dest, unsigned char* buf, int buflen ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_Forward( src, dest, buf, buflen );
|
||||
return true;
|
||||
} else {
|
||||
|
@ -198,7 +198,7 @@ class SafeCref {
|
|||
bool Connect( int socket, int nPlayersH, int nPlayersS, int seed ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
return cref->_Connect( socket, nPlayersH, nPlayersS, seed,
|
||||
m_seenSeed );
|
||||
} else {
|
||||
|
@ -209,7 +209,7 @@ class SafeCref {
|
|||
int seed ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
return cref->_Reconnect( socket, srcID, nPlayersH, nPlayersS,
|
||||
seed, m_dead );
|
||||
} else {
|
||||
|
@ -219,7 +219,7 @@ class SafeCref {
|
|||
void Disconnect(int socket, HostID hostID ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_Disconnect( socket, hostID );
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ class SafeCref {
|
|||
{
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_DeviceGone( hid, seed );
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ class SafeCref {
|
|||
bool HandleAck(HostID hostID ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_HandleAck( hostID );
|
||||
return true;
|
||||
} else {
|
||||
|
@ -246,14 +246,14 @@ class SafeCref {
|
|||
void Shutdown() {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_Shutdown();
|
||||
}
|
||||
}
|
||||
void Remove( int socket ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_Remove( socket );
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ class SafeCref {
|
|||
bool HandleHeartbeat( HostID id, int socket ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_HandleHeartbeat( id, socket );
|
||||
return true;
|
||||
} else {
|
||||
|
@ -272,7 +272,7 @@ class SafeCref {
|
|||
void CheckHeartbeats( time_t now ) {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
assert( 0 != cref->GetCookieID() );
|
||||
assert( 0 != cref->GetCid() );
|
||||
cref->_CheckHeartbeats( now );
|
||||
}
|
||||
}
|
||||
|
@ -313,10 +313,10 @@ class SafeCref {
|
|||
}
|
||||
}
|
||||
|
||||
CookieID GetCookieID() {
|
||||
CookieID GetCid() {
|
||||
if ( IsValid() ) {
|
||||
CookieRef* cref = m_cinfo->GetRef();
|
||||
return cref->GetCookieID();
|
||||
return cref->GetCid();
|
||||
} else {
|
||||
return 0; /* so don't crash.... */
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue