add comms_stop() to jni and use it

This commit is contained in:
Eric House 2013-01-20 21:33:35 -08:00
parent 132a495c4f
commit de7c29dcc7
3 changed files with 19 additions and 2 deletions

View file

@ -995,8 +995,21 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1start
( JNIEnv* env, jclass C, jint gamePtr )
{
XWJNI_START();
if ( !!state->game.comms ) {
comms_start( state->game.comms );
CommsCtxt* comms = state->game.comms;
if ( !!comms ) {
comms_start( comms );
}
XWJNI_END();
}
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1stop
( JNIEnv* env, jclass C, jint gamePtr )
{
XWJNI_START();
CommsCtxt* comms = state->game.comms;
if ( !!comms ) {
comms_stop( comms );
}
XWJNI_END();
}

View file

@ -286,6 +286,9 @@ public class JNIThread extends Thread {
// state. In some cases it'll otherwise drop the move.
XwJNI.server_do( m_jniGamePtr );
// And let it tell the relay (if any) it's leaving
XwJNI.comms_stop( m_jniGamePtr );
XwJNI.game_getGi( m_jniGamePtr, m_gi );
if ( null != m_newDict ) {
m_gi.dictName = m_newDict;

View file

@ -234,6 +234,7 @@ public class XwJNI {
// Comms
public static native void comms_start( int gamePtr );
public static native void comms_stop( int gamePtr );
public static native void comms_resetSame( int gamePtr );
public static native void comms_getAddr( int gamePtr, CommsAddrRec addr );
public static native CommsAddrRec[] comms_getAddrs( int gamePtr );