bug 1344584 - proactively close streams in test_be_conservative.js to prevent leaks r?mcmanus
MozReview-Commit-ID: 89h5lQJum6c
--- a/netwerk/test/unit/test_be_conservative.js
+++ b/netwerk/test/unit/test_be_conservative.js
@@ -68,45 +68,46 @@ class InputStreamCallback {
"should have been able to write entire response");
}
this.output.close();
do_print("done with input stream ready");
}
stop() {
this.stopped = true;
+ this.output.close();
}
}
class TLSServerSecurityObserver {
constructor(input, output) {
this.input = input;
this.output = output;
this.callbacks = [];
this.stopped = false;
}
onHandshakeDone(socket, status) {
do_print("TLS handshake done");
do_print(`TLS version used: ${status.tlsVersionUsed}`);
if (this.stopped) {
- do_print("handshake done callback stopped - closing streams and bailing");
- this.input.close();
- this.output.close();
+ do_print("handshake done callback stopped - bailing");
return;
}
let callback = new InputStreamCallback(this.output);
this.callbacks.push(callback);
this.input.asyncWait(callback, 0, 0, Services.tm.currentThread);
}
stop() {
this.stopped = true;
+ this.input.close();
+ this.output.close();
this.callbacks.forEach((callback) => {
callback.stop();
});
}
}
class ServerSocketListener {
constructor() {