From 32150049e2747b01fa45ddd1afdb22edd3571f1d Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 20 Jul 2013 06:28:35 -0700 Subject: [PATCH] assert that we aren't tracking two connected games with the same hid --- xwords4/relay/cref.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xwords4/relay/cref.cpp b/xwords4/relay/cref.cpp index ee3c92b9b..7aea5e051 100644 --- a/xwords4/relay/cref.cpp +++ b/xwords4/relay/cref.cpp @@ -1441,16 +1441,20 @@ CookieRef::printSeeds( const char* caller ) { int len = 0; char buf[64] = {0}; + uint16_t bits = 0; RWReadLock rrl( &m_socketsRWLock ); vector::const_iterator iter; for ( iter = m_sockets.begin(); iter != m_sockets.end(); ++iter ) { + HostID hostID = iter->m_hostID; + assert( 0 == (bits & (1 << hostID)) ); + bits |= 1 << hostID; len += snprintf( &buf[len], sizeof(buf)-len, "[%d]%.4x(%d)/%d/%c ", iter->m_hostID, iter->m_seed, iter->m_seed, iter->m_addr.socket(), iter->m_ackPending?'a':'A' ); } - logf( XW_LOGINFO, "seeds/sockets/ack'd after %s(): %s", caller, buf ); + logf( XW_LOGINFO, "%s: seeds/sockets/ack'd after %s(): %s", __func__, caller, buf ); } void