diff --git a/xwords4/android/jni/xwjni.c b/xwords4/android/jni/xwjni.c index 72595b0e1..727671a88 100644 --- a/xwords4/android/jni/xwjni.c +++ b/xwords4/android/jni/xwjni.c @@ -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; diff --git a/xwords4/common/server.c b/xwords4/common/server.c index f0c179280..fc597d1b1 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -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 diff --git a/xwords4/common/server.h b/xwords4/common/server.h index ba5a35c28..058c679d8 100644 --- a/xwords4/common/server.h +++ b/xwords4/common/server.h @@ -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 diff --git a/xwords4/common/util.h b/xwords4/common/util.h index be5f84d32..538c3de70 100644 --- a/xwords4/common/util.h +++ b/xwords4/common/util.h @@ -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, diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 79956ff6f..f65f6596b 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -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