commit 71bced9eb3381f47af03c93a8ef58f8c40292f6b Author: David Fifield david@bamsoftware.com Date: Mon Mar 24 20:00:24 2014 -0700
Listen on an ephemeral port and write the port number to stderr. --- firefox/components/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/firefox/components/main.js b/firefox/components/main.js index 7b962ac..74df52f 100644 --- a/firefox/components/main.js +++ b/firefox/components/main.js @@ -59,9 +59,13 @@ MeekHTTPHelper.prototype = { // https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIServer... var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"] .createInstance(Components.interfaces.nsIServerSocket); - // Listen on loopback only, with default backlog. - serverSocket.init(MeekHTTPHelper.LOCAL_PORT, true, -1); + // Listen on an ephemeral port, loopback only, with default backlog. + serverSocket.init(-1, true, -1); serverSocket.asyncListen(this); + // This output line is used by a controller program to find out what + // address the helper is listening on. For the dump call to have any + // effect, the pref browser.dom.window.dump.enabled must be true. + dump("meek-http-helper: listen 127.0.0.1:" + serverSocket.port + "\n");
// Block forever. var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] @@ -88,7 +92,6 @@ MeekHTTPHelper.prototype = {
// Global variables and functions.
-MeekHTTPHelper.LOCAL_PORT = 7000; MeekHTTPHelper.LOCAL_READ_TIMEOUT = 2.0; MeekHTTPHelper.LOCAL_WRITE_TIMEOUT = 2.0;
tor-commits@lists.torproject.org