bug 1102923 - log node moz-spdy and moz-http2 output on shutdown r=ted

This commit is contained in:
Patrick McManus 2015-01-23 12:09:47 -05:00
parent cf6b7dc423
commit 96f21bccf8
2 changed files with 14 additions and 15 deletions

View File

@ -90,17 +90,6 @@ function executeRunLater(arg) {
} }
function handleRequest(req, res) { function handleRequest(req, res) {
try {
realHandleRequest(req, res);
} catch (e) {
console.log("spdy server suffered unhandled exception. will restart " + e);
var p = webServer.address().port;
webServer.close();
webServer = spdy.createServer(options, handleRequest).listen(p, "0.0.0.0", 200, listenok);
}
}
function realHandleRequest(req, res) {
var u = url.parse(req.url); var u = url.parse(req.url);
var content = getHttpContent(u.pathname); var content = getHttpContent(u.pathname);
@ -111,8 +100,6 @@ function realHandleRequest(req, res) {
res.setHeader('X-Connection-Spdy', 'no'); res.setHeader('X-Connection-Spdy', 'no');
} }
console.log(u.pathname);
if (u.pathname === '/750ms') { if (u.pathname === '/750ms') {
var rl = new runlater(); var rl = new runlater();
rl.req = req; rl.req = req;

View File

@ -949,7 +949,7 @@ class XPCShellTests(object):
# We pipe stdin to node because the spdy server will exit when its # We pipe stdin to node because the spdy server will exit when its
# stdin reaches EOF # stdin reaches EOF
process = Popen([nodeBin, serverJs], stdin=PIPE, stdout=PIPE, process = Popen([nodeBin, serverJs], stdin=PIPE, stdout=PIPE,
stderr=STDOUT, env=self.env, cwd=os.getcwd()) stderr=PIPE, env=self.env, cwd=os.getcwd())
self.nodeProc[name] = process self.nodeProc[name] = process
# Check to make sure the server starts properly by waiting for it to # Check to make sure the server starts properly by waiting for it to
@ -979,7 +979,19 @@ class XPCShellTests(object):
""" """
for name, proc in self.nodeProc.iteritems(): for name, proc in self.nodeProc.iteritems():
self.log.info('Node %s server shutting down ...' % name) self.log.info('Node %s server shutting down ...' % name)
proc.terminate() if proc.poll() is not None:
self.log.info('Node server %s already dead %s' % (name, proc.poll()))
else:
proc.terminate()
def dumpOutput(fd, label):
firstTime = True
for msg in fd:
if firstTime:
firstTime = False;
self.log.info('Process %s' % label)
self.log.info(msg)
dumpOutput(proc.stdout, "stdout")
dumpOutput(proc.stderr, "stderr")
def buildXpcsRunArgs(self): def buildXpcsRunArgs(self):
""" """