[mw-devel] MW3 r1180 - trunk/webclient

arthur at sucs.org arthur at sucs.org
Thu Oct 7 16:33:53 BST 2010


Author: arthur
Date: 2010-10-07 16:33:53 +0100 (Thu, 07 Oct 2010)
New Revision: 1180

Modified:
   trunk/webclient/say.js
Log:
catch errors properly and allow the session to stop.


Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js	2010-10-07 15:13:09 UTC (rev 1179)
+++ trunk/webclient/say.js	2010-10-07 15:33:53 UTC (rev 1180)
@@ -8,7 +8,12 @@
 		} else
 		if (msg.status) {
 			tmo = 10000;
-			$("#textlist").append( "<div class='msg"+type+"'>Problem: " + msg.status + "</div");
+			if (msg.status == "Socket open error") {
+				$("#textlist").append( "<div class='msg"+type+"'><b><i>Session Closed</i></b></div");
+				tmo = 0;
+			}else {
+				$("#textlist").append( "<div class='msg"+type+"'>Problem: " + msg.status + "</div");
+			}
 		} else {
 			for (one in msg) {
 				if (msg[one].state == 23) return tmo;
@@ -57,11 +62,11 @@
 			timeout: 50000,
 			success: function(data) {
 				var tmo = addmsg("poll", data);
-				setTimeout( 'waitForMsg()', tmo);
+				if (tmo>0) setTimeout( 'waitForMsg()', tmo);
 			},
 			error: function(XMLHttpRequest, textStatus, errorThrown){
-				addmsg("error", textStatus+" ("+errorThrown+")");
-				setTimeout('waitForMsg()', 10000);
+				var tmo = addmsg("error", textStatus+" ("+errorThrown+")");
+				if (tmp>0) setTimeout('waitForMsg()', tmo);
 			},
 		});
 	}




More information about the mw-devel mailing list