bug 1063648 - don't cache transport. r=jryans

This commit is contained in:
Paul Rouget 2014-09-08 14:18:20 -05:00
parent a779a752ee
commit 45422188ae

View File

@ -193,8 +193,8 @@ Connection.prototype = {
return;
}
if (!this._client) {
this._transport = transport;
if (this._transport) {
this._customTransport = transport;
if (this._customTransport) {
this.log("connecting (custom transport)");
} else {
this.log("connecting to " + this.host + ":" + this.port);
@ -223,12 +223,15 @@ Connection.prototype = {
},
_clientConnect: function () {
if (!this._transport) {
let transport;
if (this._customTransport) {
transport = this._customTransport;
} else {
if (!this.host) {
this._transport = DebuggerServer.connectPipe();
transport = DebuggerServer.connectPipe();
} else {
try {
this._transport = debuggerSocketConnect(this.host, this.port);
transport = debuggerSocketConnect(this.host, this.port);
} catch (e) {
// In some cases, especially on Mac, the openOutputStream call in
// debuggerSocketConnect may throw NS_ERROR_NOT_INITIALIZED.
@ -240,7 +243,7 @@ Connection.prototype = {
}
}
}
this._client = new DebuggerClient(this._transport);
this._client = new DebuggerClient(transport);
this._client.addOneTimeListener("closed", this._onDisconnected);
this._client.connect(this._onConnected);
},
@ -259,6 +262,7 @@ Connection.prototype = {
_onDisconnected: function() {
this._client = null;
this._customTransport = null;
if (this._status == Connection.Status.CONNECTING && this.keepConnecting) {
setTimeout(() => this._clientConnect(), 100);