mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
lookup hearbeat recipient by socket rather then cookieID since
cookieID isn't always correct until later
This commit is contained in:
parent
e65db4b8c2
commit
11b586cd4b
1 changed files with 6 additions and 4 deletions
|
@ -194,13 +194,15 @@ processHeartbeat( unsigned char* buf, int bufLen, int socket )
|
|||
HostID hostID;
|
||||
bool success = false;
|
||||
|
||||
if ( getNetShort( &buf, end, &cookieID )
|
||||
if ( getNetShort( &buf, end, &cookieID ) /* may be wrong if ALLCONN hasn't been sent */
|
||||
&& getNetByte( &buf, end, &hostID ) ) {
|
||||
logf( XW_LOGINFO, "processHeartbeat: cookieID 0x%lx, hostID 0x%x",
|
||||
cookieID, hostID );
|
||||
|
||||
SafeCref scr( cookieID );
|
||||
success = scr.HandleHeartbeat( hostID, socket );
|
||||
{
|
||||
SafeCref scr( socket );
|
||||
success = scr.HandleHeartbeat( hostID, socket );
|
||||
}
|
||||
if ( !success ) {
|
||||
killSocket( socket, "no cref for socket" );
|
||||
}
|
||||
|
@ -375,7 +377,7 @@ processDisconnect( unsigned char* bufp, int bufLen, int socket )
|
|||
if ( getNetShort( &bufp, end, &cookieID )
|
||||
&& getNetByte( &bufp, end, &hostID ) ) {
|
||||
|
||||
SafeCref scr( cookieID );
|
||||
SafeCref scr( socket );
|
||||
scr.Disconnect( socket, hostID );
|
||||
success = true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue