From 2d4ae3e44ae82dfdfeb230fa94d409e2374448d7 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 8 Nov 2009 21:32:36 +0000 Subject: [PATCH] When forwarding message, lookup cref by socket if cookieID == 0, as can be the case when through to a non-all-connected game. --- xwords4/relay/xwrelay.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xwords4/relay/xwrelay.cpp b/xwords4/relay/xwrelay.cpp index e67f60bce..1ad176506 100644 --- a/xwords4/relay/xwrelay.cpp +++ b/xwords4/relay/xwrelay.cpp @@ -427,8 +427,13 @@ forwardMessage( unsigned char* buf, int buflen, int srcSocket ) && getNetByte( &bufp, end, &dest ) ) { logf( XW_LOGINFO, "cookieID = %d", cookieID ); - SafeCref scr( cookieID ); - success = scr.Forward( src, dest, buf, buflen ); + if ( COOKIE_ID_NONE == cookieID ) { + SafeCref scr( srcSocket ); + success = scr.Forward( src, dest, buf, buflen ); + } else { + SafeCref scr( cookieID ); /* won't work if not allcon; will be 0 */ + success = scr.Forward( src, dest, buf, buflen ); + } } return success; } /* forwardMessage */