Mercurial > hg > rlgwebd
comparison rlgwebd.js @ 29:cf9d294bc52f
rlgwebd.js: fix reference error
httpServer needs to be in the global scope so shutdown() can find it.
| author | John "Elwin" Edwards <elwin@sdf.org> |
|---|---|
| date | Mon, 04 Jun 2012 21:34:57 -0700 |
| parents | 2ad2b6491aa9 |
| children | b5570a594266 |
comparison
equal
deleted
inserted
replaced
| 28:2ad2b6491aa9 | 29:cf9d294bc52f |
|---|---|
| 687 if (process.getuid() != 0) { | 687 if (process.getuid() != 0) { |
| 688 tslog("Not running as root, cannot chroot."); | 688 tslog("Not running as root, cannot chroot."); |
| 689 process.exit(1); | 689 process.exit(1); |
| 690 } | 690 } |
| 691 | 691 |
| 692 var httpServer; // declare here so shutdown() can find it | |
| 693 | |
| 692 /* Open the control socket before chrooting where it can't be found */ | 694 /* Open the control socket before chrooting where it can't be found */ |
| 693 var ctlServer = net.createServer(function (sock) { | 695 var ctlServer = net.createServer(function (sock) { |
| 694 sock.on('data', conHandler); | 696 sock.on('data', conHandler); |
| 695 }); | 697 }); |
| 696 ctlServer.listen(ctlsocket, function () { | 698 ctlServer.listen(ctlsocket, function () { |
| 717 } | 719 } |
| 718 catch (err) { | 720 catch (err) { |
| 719 tslog("Could not drop permissions: %s", err); | 721 tslog("Could not drop permissions: %s", err); |
| 720 process.exit(1); | 722 process.exit(1); |
| 721 } | 723 } |
| 722 var httpServer = http.createServer(webHandler); | 724 httpServer = http.createServer(webHandler); |
| 723 httpServer.listen(8080, "127.0.0.1"); | 725 httpServer.listen(8080, "127.0.0.1"); |
| 724 tslog('rlgwebd running at http://127.0.0.1:8080/'); | 726 tslog('rlgwebd running at http://127.0.0.1:8080/'); |
| 725 }); | 727 }); |
| 726 | 728 |
