Better web-socket-js dataQueue reset.

At connect and close time instead of initialization time.
This commit is contained in:
Joel Martin 2010-07-01 10:35:03 -05:00
parent 9479c72083
commit 4a96178307
1 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,6 @@ public class WebSocket extends EventDispatcher {
headers:String = null) { headers:String = null) {
this.main = main; this.main = main;
initNoiseChars(); initNoiseChars();
dataQueue = [];
this.url = url; this.url = url;
var m:Array = url.match(/^(\w+):\/\/([^\/:]+)(:(\d+))?(\/.*)?$/); var m:Array = url.match(/^(\w+):\/\/([^\/:]+)(:(\d+))?(\/.*)?$/);
if (!m) main.fatal("SYNTAX_ERR: invalid url: " + url); if (!m) main.fatal("SYNTAX_ERR: invalid url: " + url);
@ -135,6 +134,7 @@ public class WebSocket extends EventDispatcher {
public function close():void { public function close():void {
main.log("close"); main.log("close");
dataQueue = [];
try { try {
socket.close(); socket.close();
} catch (ex:Error) { } } catch (ex:Error) { }
@ -160,6 +160,7 @@ public class WebSocket extends EventDispatcher {
tlsSocket.startTLS(rawSocket, host, tlsConfig); tlsSocket.startTLS(rawSocket, host, tlsConfig);
} }
dataQueue = [];
var hostValue:String = host + (port == 80 ? "" : ":" + port); var hostValue:String = host + (port == 80 ? "" : ":" + port);
var cookie:String = ""; var cookie:String = "";
if (main.getCallerHost() == host) { if (main.getCallerHost() == host) {