Bug 1103120 - Part 21: Client: Close streams when connection refused. r=past
authorJ. Ryan Stinnett <jryans@gmail.com>
Mon, 26 Jan 2015 12:47:14 -0600
changeset 225863 fabdf209d813af166f9a4376ff5d351d19152e5c
parent 225862 182fc9215d27f8641de189072a5b81d47fc5c27c
child 225864 0f87f9d002c11ff8b42654664d9a35911ff93017
push id28176
push userryanvm@gmail.com
push dateMon, 26 Jan 2015 21:48:45 +0000
treeherdermozilla-central@38e4719e71af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs1103120
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1103120 - Part 21: Client: Close streams when connection refused. r=past
toolkit/devtools/security/socket.js
--- a/toolkit/devtools/security/socket.js
+++ b/toolkit/devtools/security/socket.js
@@ -162,17 +162,28 @@ let _getTransport = Task.async(function*
 let _attemptTransport = Task.async(function*(settings) {
   let { authenticator } = settings;
   // _attemptConnect only opens the streams.  Any failures at that stage
   // aborts the connection process immedidately.
   let { s, input, output } = yield _attemptConnect(settings);
 
   // Check if the input stream is alive.  If encryption is enabled, we need to
   // watch out for cert errors by testing the input stream.
-  let { alive, certError } = yield _isInputAlive(input);
+  let alive, certError;
+  try {
+    let results = yield _isInputAlive(input);
+    alive = results.alive;
+    certError = results.certError;
+  } catch(e) {
+    // For other unexpected errors, like NS_ERROR_CONNECTION_REFUSED, we reach
+    // this block.
+    input.close();
+    output.close();
+    throw e;
+  }
   dumpv("Server cert accepted? " + !certError);
 
   // The |Authenticator| examines the connection as well and may determine it
   // should be dropped.
   alive = alive && authenticator.validateConnection({
     host: settings.host,
     port: settings.port,
     encryption: settings.encryption,