From bda5113fa5bb529a4c8be1811adef9df3a37fddb Mon Sep 17 00:00:00 2001 From: David Glasser Date: Mon, 7 Oct 2013 14:18:29 -0700 Subject: [PATCH] meteor run: Handle errors in the websocket proxy by closing socket instead of throwing --- tools/run.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/run.js b/tools/run.js index 328908d984..c9d8b7f19b 100644 --- a/tools/run.js +++ b/tools/run.js @@ -181,14 +181,15 @@ var startProxy = function (outerPort, innerPort, callback) { // don't crash if the app doesn't respond. instead return an error // immediately. This shouldn't happen much since we try to not send requests // if the app is down. - // XXX should we also handle http-proxy:outgoing:ws:error, for a failed - // websocket? proxy.ee.on('http-proxy:outgoing:web:error', function (err, req, res) { res.writeHead(503, { 'Content-Type': 'text/plain' }); res.end('Unexpected error.'); }); + proxy.ee.on('http-proxy:outgoing:ws:error', function (err, req, socket) { + socket.close(); + }); server.listen(outerPort, callback); };