mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
add comms_transportFailed, and call when relay goes down. This makes
icon change correctly and comms start trying to reconnect, but the loop in CommsTransport can't be restarted yet.
This commit is contained in:
parent
55abf1116b
commit
f430a84d75
4 changed files with 18 additions and 0 deletions
|
@ -979,6 +979,16 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll
|
|||
XWJNI_END();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1transportFailed
|
||||
( JNIEnv* env, jclass C, jint gamePtr )
|
||||
{
|
||||
XWJNI_START();
|
||||
XP_ASSERT( !!state->game.comms );
|
||||
(void)comms_transportFailed( state->game.comms );
|
||||
XWJNI_END();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame
|
||||
( JNIEnv* env, jclass C, jint gamePtr )
|
||||
|
|
|
@ -110,6 +110,8 @@ public class CommsTransport extends Thread implements TransportProcs {
|
|||
m_socketChannel.register( m_selector, ops );
|
||||
m_selector.select();
|
||||
} catch ( ClosedChannelException cce ) {
|
||||
// we get this when relay goes down. Need to notify!
|
||||
m_jniThread.handle( JNICmd.CMD_TRANSFAIL );
|
||||
Utils.logf( "exiting: " + cce.toString() );
|
||||
break;
|
||||
} catch ( java.io.IOException ioe ) {
|
||||
|
|
|
@ -22,6 +22,7 @@ public class JNIThread extends Thread {
|
|||
CMD_START,
|
||||
CMD_DO,
|
||||
CMD_RECEIVE,
|
||||
CMD_TRANSFAIL,
|
||||
CMD_PREFS_CHANGE,
|
||||
CMD_PEN_DOWN,
|
||||
CMD_PEN_MOVE,
|
||||
|
@ -288,6 +289,10 @@ public class JNIThread extends Thread {
|
|||
handle( JNICmd.CMD_DO );
|
||||
break;
|
||||
|
||||
case CMD_TRANSFAIL:
|
||||
XwJNI.comms_transportFailed( m_jniGamePtr );
|
||||
break;
|
||||
|
||||
case CMD_PREFS_CHANGE:
|
||||
// need to inval all because some of prefs,
|
||||
// e.g. colors, aren't known by common code so
|
||||
|
|
|
@ -160,6 +160,7 @@ public class XwJNI {
|
|||
public static native void comms_getAddr( int gamePtr, CommsAddrRec addr );
|
||||
public static native void comms_setAddr( int gamePtr, CommsAddrRec addr );
|
||||
public static native void comms_resendAll( int gamePtr );
|
||||
public static native void comms_transportFailed( int gamePtr );
|
||||
|
||||
// Dicts
|
||||
public static native boolean dict_tilesAreSame( int dictPtr1, int dictPtr2 );
|
||||
|
|
Loading…
Reference in a new issue