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