From 2cd84c4229f5277aaea46090382cd6dc9fc46240 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 5 Jul 2013 08:03:03 -0700 Subject: [PATCH] test that address is good each time through loop --- xwords4/relay/cref.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/xwords4/relay/cref.cpp b/xwords4/relay/cref.cpp index c5fd9805e..106d5f57c 100644 --- a/xwords4/relay/cref.cpp +++ b/xwords4/relay/cref.cpp @@ -857,21 +857,19 @@ void CookieRef::send_stored_messages( HostID dest, const AddrInfo* addr ) { logf( XW_LOGVERBOSE0, "%s(dest=%d)", __func__, dest ); - assert( dest > 0 && dest <= 4 ); - if ( addr->isCurrent() ) { - DBMgr* dbmgr = DBMgr::Get(); - const char* cname = ConnName(); - for ( ; ; ) { - unsigned char buf[MAX_MSG_LEN]; - size_t buflen = sizeof(buf); - int msgID; - if ( !dbmgr->GetStoredMessage( cname, dest, buf, &buflen, &msgID ) - || ! send_with_length( addr, dest, buf, buflen, true ) ) { - break; - } - dbmgr->RemoveStoredMessages( &msgID, 1 ); - } + + DBMgr* dbmgr = DBMgr::Get(); + const char* cname = ConnName(); + while ( addr->isCurrent() ) { + unsigned char buf[MAX_MSG_LEN]; + size_t buflen = sizeof(buf); + int msgID; + if ( !dbmgr->GetStoredMessage( cname, dest, buf, &buflen, &msgID ) + || ! send_with_length( addr, dest, buf, buflen, true ) ) { + break; + } + dbmgr->RemoveStoredMessages( &msgID, 1 ); } } /* send_stored_messages */