project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/NetplayService.java
changeset 7349 12fdfd2038d4
parent 7346 b0f67c5b4215
child 7355 5673e95ef647
--- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/NetplayService.java	Thu Jul 19 22:55:36 2012 +0200
+++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/NetplayService.java	Sat Jul 21 14:56:52 2012 +0200
@@ -7,6 +7,7 @@
 import android.os.Binder;
 import android.os.CountDownTimer;
 import android.os.IBinder;
+import android.util.Log;
 
 public class NetplayService extends Service {
 	private final NetplayBinder binder = new NetplayBinder();
@@ -20,6 +21,7 @@
 	
 	@Override
 	public void onCreate() {
+		Log.d("NetplayService", "Creating");
 		if(Flib.INSTANCE.flib_init() != 0) {
 			throw new RuntimeException("Unable to start frontlib");
 		}
@@ -32,7 +34,7 @@
     	timer = new CountDownTimer(Long.MAX_VALUE, 50) {
 			@Override
 			public void onTick(long millisUntilFinished) {
-				if(netconn != null) {
+				if(netconn != null && netconn.isConnected()) {
 					netconn.tick();
 				}
 			}
@@ -46,6 +48,7 @@
 	
 	@Override
 	public void onDestroy() {
+		Log.d("NetplayService", "Destroying");
 		timer.cancel();
 		netconn.disconnect();
 		Flib.INSTANCE.flib_quit();