[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torbutton/master] Bug 8642: Fix a hang on New Identity.
commit ad4e95564a049429ff5fd86f3cddb25fd3c03e12
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Thu Apr 4 18:34:04 2013 -0700
Bug 8642: Fix a hang on New Identity.
Buffering is likely eating our commands, causing us to wait forever for
responses.. Let's hope setting the buffer size and counts to 1 each will do
the trick :/.
---
src/chrome/content/torbutton.js | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 0034e1a..f8b25d1 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -1245,8 +1245,12 @@ function torbutton_send_ctrl_cmd(command) {
var socketTransportService = Components.classes["@mozilla.org/network/socket-transport-service;1"]
.getService(Components.interfaces.nsISocketTransportService);
var socket = socketTransportService.createTransport(null, 0, m_tb_control_host, m_tb_control_port, null);
- var input = socket.openInputStream(3, 0, 0); // 3 == OPEN_BLOCKING|OPEN_UNBUFFERED
- var output = socket.openOutputStream(3, 0, 0); // 3 == OPEN_BLOCKING|OPEN_UNBUFFERED
+
+ // If we don't get a response from the control port in 2 seconds, someting is wrong..
+ socket.setTimeout(Ci.nsISocketTransport.TIMEOUT_READ_WRITE, 2);
+
+ var input = socket.openInputStream(3, 1, 1); // 3 == OPEN_BLOCKING|OPEN_UNBUFFERED
+ var output = socket.openOutputStream(3, 1, 1); // 3 == OPEN_BLOCKING|OPEN_UNBUFFERED
var inputStream = Cc["@mozilla.org/binaryinputstream;1"].createInstance(Ci.nsIBinaryInputStream);
var outputStream = Cc["@mozilla.org/binaryoutputstream;1"].createInstance(Ci.nsIBinaryOutputStream);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits