return succes from server_initClientConnection()

This commit is contained in:
Eric House 2014-09-14 13:42:11 -07:00
parent 7d8b9b4270
commit 6f07098cf3
5 changed files with 18 additions and 20 deletions

View file

@ -1177,17 +1177,19 @@ and_send_on_close( XWStreamCtxt* stream, void* closure )
comms_send( state->game.comms, stream );
}
JNIEXPORT void JNICALL
JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_server_1initClientConnection
( JNIEnv* env, jclass C, jint gamePtr )
{
jboolean result;
LOG_FUNC();
XWJNI_START_GLOBALS();
XWStreamCtxt* stream = and_empty_stream( MPPARM(mpool) globals );
stream_setOnCloseProc( stream, and_send_on_close );
server_initClientConnection( state->game.server, stream );
result = server_initClientConnection( state->game.server, stream );
XWJNI_END();
LOG_RETURN_VOID();
LOG_RETURNF( "%d", result );
return result;
}
JNIEXPORT void JNICALL

View file

@ -116,7 +116,7 @@ XP_Bool server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming );
/* client-side messages. Client (platform code)owns the stream used to talk
* to the server, and passes it in. */
#ifndef XWFEATURE_STANDALONE_ONLY
void server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream );
XP_Bool server_initClientConnection( ServerCtxt* server, XWStreamCtxt* stream );
#endif
#ifdef XWFEATURE_CHAT

View file

@ -2168,17 +2168,12 @@ cursesmain( XP_Bool isServer, LaunchParams* params )
#ifndef XWFEATURE_STANDALONE_ONLY
/* send any events that need to get off before the event loop begins */
if ( !isServer ) {
if ( 1 /* stream_open( params->info.clientInfo.stream ) */) {
server_initClientConnection( cGlobals->game.server,
mem_stream_make( MEMPOOL
params->vtMgr,
cGlobals,
(XP_PlayerAddr)0,
sendOnClose ) );
} else {
cursesUserError( &g_globals, "Unable to open connection to server");
exit( 0 );
}
(void)server_initClientConnection( cGlobals->game.server,
mem_stream_make( MEMPOOL
params->vtMgr,
cGlobals,
(XP_PlayerAddr)0,
sendOnClose ) );
}
#endif

View file

@ -578,8 +578,8 @@ createOrLoadObjects( GtkGameGlobals* globals )
mem_stream_make( MEMPOOL params->vtMgr,
cGlobals, CHANNEL_NONE,
sendOnClose );
server_initClientConnection( cGlobals->game.server,
stream );
(void)server_initClientConnection( cGlobals->game.server,
stream );
}
#endif
}
@ -945,8 +945,8 @@ new_game_impl( GtkGameGlobals* globals, XP_Bool fireConnDlg )
mem_stream_make( MEMPOOL globals->cGlobals.params->vtMgr,
&globals->cGlobals, CHANNEL_NONE,
sendOnClose );
server_initClientConnection( globals->cGlobals.game.server,
stream );
(void)server_initClientConnection( globals->cGlobals.game.server,
stream );
}
#endif
(void)server_do( globals->cGlobals.game.server ); /* assign tiles, etc. */

View file

@ -1439,7 +1439,8 @@ linuxChangeRoles( CommonGlobals* cGlobals )
XWStreamCtxt* stream =
mem_stream_make( MPPARM(cGlobals->util->mpool) cGlobals->params->vtMgr,
cGlobals, CHANNEL_NONE, sendOnClose );
server_initClientConnection( server, stream );
XP_Bool done = server_initClientConnection( server, stream );
XP_ASSERT( !done );
}
(void)server_do( server );
}