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