mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
make server_initClientConnection() make its own stream
This commit is contained in:
parent
da639af7c3
commit
15fde8044f
5 changed files with 9 additions and 22 deletions
|
@ -2038,9 +2038,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection
|
|||
jboolean result;
|
||||
LOG_FUNC();
|
||||
XWJNI_START_GLOBALS();
|
||||
XWStreamCtxt* stream = and_empty_stream( MPPARM(mpool) globals );
|
||||
stream_setOnCloseProc( stream, and_send_on_close );
|
||||
result = server_initClientConnection( state->game.server, env, stream );
|
||||
result = server_initClientConnection( state->game.server, env );
|
||||
XWJNI_END();
|
||||
LOG_RETURNF( "%s", boolToStr(result) );
|
||||
return result;
|
||||
|
|
|
@ -693,7 +693,7 @@ readMQTTDevID( ServerCtxt* server, XWStreamCtxt* stream )
|
|||
}
|
||||
|
||||
XP_Bool
|
||||
server_initClientConnection( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
|
||||
server_initClientConnection( ServerCtxt* server, XWEnv xwe )
|
||||
{
|
||||
XP_Bool result;
|
||||
XP_LOGFF( "gameState: %s; gameID: %d", getStateStr(server->nv.gameState),
|
||||
|
@ -706,13 +706,10 @@ server_initClientConnection( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream
|
|||
#endif
|
||||
|
||||
XP_ASSERT( gi->serverRole == SERVER_ISCLIENT );
|
||||
XP_ASSERT( stream != NULL );
|
||||
result = server->nv.gameState == XWSTATE_NONE;
|
||||
if ( result ) {
|
||||
stream_open( stream );
|
||||
|
||||
writeProto( server, stream, XWPROTO_DEVICE_REGISTRATION );
|
||||
|
||||
XWStreamCtxt* stream = messageStreamWithHeader( server, xwe, SERVER_DEVICE,
|
||||
XWPROTO_DEVICE_REGISTRATION );
|
||||
nPlayers = gi->nPlayers;
|
||||
XP_ASSERT( nPlayers > 0 );
|
||||
XP_U16 localPlayers = gi_countLocalPlayers( gi, XP_FALSE);
|
||||
|
@ -747,12 +744,11 @@ server_initClientConnection( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream
|
|||
#ifdef STREAM_VERS_BIGBOARD
|
||||
stream_putU8( stream, CUR_STREAM_VERS );
|
||||
#endif
|
||||
|
||||
stream_destroy( stream, xwe );
|
||||
} else {
|
||||
XP_LOGFF( "wierd state: %s (expected XWSTATE_NONE); dropping message",
|
||||
getStateStr(server->nv.gameState) );
|
||||
}
|
||||
stream_destroy( stream, xwe );
|
||||
return result;
|
||||
} /* server_initClientConnection */
|
||||
#endif
|
||||
|
|
|
@ -115,8 +115,7 @@ XP_Bool server_receiveMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* inco
|
|||
/* client-side messages. Client (platform code)owns the stream used to talk
|
||||
* to the server, and passes it in. */
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
XP_Bool server_initClientConnection( ServerCtxt* server, XWEnv xwe,
|
||||
XWStreamCtxt* stream );
|
||||
XP_Bool server_initClientConnection( ServerCtxt* server, XWEnv xwe );
|
||||
#endif
|
||||
|
||||
#ifdef XWFEATURE_CHAT
|
||||
|
|
|
@ -86,8 +86,8 @@ typedef XP_Bool (*XWTimerProc)( void* closure, XWEnv xwe, XWTimerReason why );
|
|||
typedef struct UtilVtable {
|
||||
|
||||
#ifndef XWFEATURE_STANDALONE_ONLY
|
||||
XWStreamCtxt* (*m_util_makeStreamFromAddr )(XW_UtilCtxt* uc, XWEnv xwe,
|
||||
XP_PlayerAddr channelNo );
|
||||
XWStreamCtxt* (*m_util_makeStreamFromAddr)(XW_UtilCtxt* uc, XWEnv xwe,
|
||||
XP_PlayerAddr channelNo );
|
||||
#endif
|
||||
|
||||
XWBonusType (*m_util_getSquareBonus)( XW_UtilCtxt* uc, XWEnv xwe, XP_U16 boardSize,
|
||||
|
|
|
@ -131,13 +131,7 @@ streamFromFile( CommonGlobals* cGlobals, char* name )
|
|||
void
|
||||
tryConnectToServer( CommonGlobals* cGlobals )
|
||||
{
|
||||
LaunchParams* params = cGlobals->params;
|
||||
XWStreamCtxt* stream =
|
||||
mem_stream_make( MPPARM(cGlobals->util->mpool) params->vtMgr,
|
||||
cGlobals, CHANNEL_NONE,
|
||||
sendOnClose );
|
||||
(void)server_initClientConnection( cGlobals->game.server, NULL_XWE,
|
||||
stream );
|
||||
(void)server_initClientConnection( cGlobals->game.server, NULL_XWE );
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue