frontlib: Added missing disconnect case
authorMedo <smaxein@googlemail.com>
Wed, 11 Jul 2012 01:40:35 +0200
changeset 7324 fb6bfe8e30c8
parent 7322 18e1fba30f99
child 7326 1fae07363938
frontlib: Added missing disconnect case
project_files/frontlib/net/netconn.c
project_files/frontlib/net/netconn.h
--- a/project_files/frontlib/net/netconn.c	Tue Jul 10 19:40:10 2012 +0200
+++ b/project_files/frontlib/net/netconn.c	Wed Jul 11 01:40:35 2012 +0200
@@ -620,6 +620,11 @@
 	    }
 		flib_netmsg_destroy(netmsg);
 	}
+
+	if(!exit && !conn->destroyRequested && !flib_netbase_connected(net)) {
+		conn->netconnState = NETCONN_STATE_DISCONNECTED;
+		conn->onDisconnectedCb(conn->onDisconnectedCtx, NETCONN_DISCONNECT_CONNLOST, "Connection lost");
+	}
 }
 
 void flib_netconn_tick(flib_netconn *conn) {
--- a/project_files/frontlib/net/netconn.h	Tue Jul 10 19:40:10 2012 +0200
+++ b/project_files/frontlib/net/netconn.h	Wed Jul 11 01:40:35 2012 +0200
@@ -37,6 +37,7 @@
 #define NETCONN_DISCONNECT_NORMAL 0
 #define NETCONN_DISCONNECT_SERVER_TOO_OLD 1
 #define NETCONN_DISCONNECT_AUTH_FAILED 2 // TODO can you retry instead?
+#define NETCONN_DISCONNECT_CONNLOST 3
 #define NETCONN_DISCONNECT_INTERNAL_ERROR 100
 
 #define NETCONN_ROOMLEAVE_ABANDONED 0