Skip to content
Snippets Groups Projects
Verified Commit 3f92800f authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 10760: Integrate TorButton to TorBrowser core

Bug 40501: High CPU load after tor exits unexpectedly

When a peers (tor) disconnects, Firefox seems to keep the stream open,
and return 0 on available, rather than throwing.
So, as a matter of fact, we had a while trying to read 0 bytes without
any pause in _readLine, hence the 100% CPU usage.
parent 8b0fc790
Branches
Tags
1 merge request!609Bug 41687: Rebased alpha to 102.10
......@@ -135,6 +135,18 @@ class AsyncSocket {
this.inputQueue.push({
onInputStreamReady: stream => {
try {
if (!this.scriptableInputStream.available()) {
// This means EOF, but not closed yet. However, arriving at EOF
// should be an error condition for us, since we are in a socket,
// and EOF should mean peer disconnected.
// If the stream has been closed, this function itself should
// throw.
reject(
new Error("onInputStreamReady called without available bytes.")
);
return;
}
// read our string from input stream
let str = this.scriptableInputStream.read(
this.scriptableInputStream.available()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment