drop client connection when in the wrong state rather than asserting.

This commit is contained in:
eehouse 2010-02-11 13:29:28 +00:00
parent bd611bb6f4
commit fc2e87e0c4

View file

@ -474,8 +474,7 @@ server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream )
XP_ASSERT( gi->serverRole == SERVER_ISCLIENT );
XP_ASSERT( stream != NULL );
XP_ASSERT( server->nv.gameState == XWSTATE_NONE );
if ( server->nv.gameState == XWSTATE_NONE ) {
stream_open( stream );
stream_putBits( stream, XWPROTO_NBITS, XWPROTO_DEVICE_REGISTRATION );
@ -502,7 +501,10 @@ server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream )
stream_putBits( stream, NAME_LEN_NBITS, len );
stream_putBytes( stream, name, len );
}
} else {
XP_LOGF( "%s: wierd state %s; dropping message", __func__,
getStateStr(server->nv.gameState) );
}
stream_destroy( stream );
} /* server_initClientConnection */
#endif