mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
log an error and drop bad fwd packet rather than assert
This commit is contained in:
parent
17edc79aaf
commit
0d4e839dba
1 changed files with 25 additions and 22 deletions
|
@ -1048,34 +1048,37 @@ void
|
|||
CookieRef::forward_or_store( const CRefEvent* evt )
|
||||
{
|
||||
unsigned char* buf = evt->u.fwd.buf;
|
||||
int buflen = evt->u.fwd.buflen;
|
||||
HostID dest = evt->u.fwd.dest;
|
||||
do {
|
||||
/* This is an ugly hack!!!! */
|
||||
if ( *buf == XWRELAY_MSG_TORELAY ) {
|
||||
*buf = XWRELAY_MSG_FROMRELAY;
|
||||
} else if ( *buf == XWRELAY_MSG_TORELAY_NOCONN ) {
|
||||
*buf = XWRELAY_MSG_FROMRELAY_NOCONN;
|
||||
} else {
|
||||
logf( XW_LOGERROR, "%s: got XWRELAY type of %d", __func__,
|
||||
*buf );
|
||||
break;
|
||||
}
|
||||
|
||||
int destSocket = SocketForHost( dest );
|
||||
int buflen = evt->u.fwd.buflen;
|
||||
HostID dest = evt->u.fwd.dest;
|
||||
int destSocket = SocketForHost( dest );
|
||||
|
||||
/* This is an ugly hack!!!! */
|
||||
if ( *buf == XWRELAY_MSG_TORELAY ) {
|
||||
*buf = XWRELAY_MSG_FROMRELAY;
|
||||
} else if ( *buf == XWRELAY_MSG_TORELAY_NOCONN ) {
|
||||
*buf = XWRELAY_MSG_FROMRELAY_NOCONN;
|
||||
} else {
|
||||
assert( 0 ); /* don't ship this */
|
||||
}
|
||||
if ( 0 < m_delayMicros && destSocket != -1 ) {
|
||||
usleep( m_delayMicros );
|
||||
}
|
||||
|
||||
if ( 0 < m_delayMicros && destSocket != -1 ) {
|
||||
usleep( m_delayMicros );
|
||||
}
|
||||
if ( (destSocket == -1)
|
||||
|| !send_with_length( destSocket, buf, buflen, true ) ) {
|
||||
store_message( dest, buf, buflen );
|
||||
}
|
||||
|
||||
if ( (destSocket == -1)
|
||||
|| !send_with_length( destSocket, buf, buflen, true ) ) {
|
||||
store_message( dest, buf, buflen );
|
||||
}
|
||||
|
||||
/* also note that we've heard from src recently */
|
||||
/* also note that we've heard from src recently */
|
||||
#ifdef RELAY_HEARTBEAT
|
||||
HostID src = evt->u.fwd.src;
|
||||
pushHeartbeatEvent( src, SocketForHost(src) );
|
||||
HostID src = evt->u.fwd.src;
|
||||
pushHeartbeatEvent( src, SocketForHost(src) );
|
||||
#endif
|
||||
} while ( 0 );
|
||||
} /* forward_or_store */
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue