Skip to content
Browse files

Catch HTTP server errors (especially EADDRINUSE) of File API hack (fo…

…r Zap and Shake demo).

Jira issue: WP-60

This is just a quick fix: Only one HTTP server per machine is allowed. Further PZPs on the same machine will no longer crash, but won't provide access to their filesystems.
  • Loading branch information...
1 parent ad1e528 commit fcb3f0af51019971288cb95703ce89d1699fd9c1 @felixjendrusch felixjendrusch committed May 29, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 webinos/api/file/lib/webinos.file.hack.js
View
12 webinos/api/file/lib/webinos.file.hack.js
@@ -1,8 +1,14 @@
(function () {
var nConnect = require("connect"),
+ nHttp = require("http"),
nPath = require("path");
-
- nConnect()
- .use(nConnect.static(nPath.join(process.cwd(), "default")))
+
+ var app = nConnect().use(nConnect.static(nPath.join(process.cwd(), "default")));
+
+ nHttp
+ .createServer(app)
+ .on("error", function (error) {
+ console.log("webinos.file.hack.js: Error starting `connect` middleware (" + error + ").");
+ })
.listen(6789);
})();

0 comments on commit fcb3f0a

Please sign in to comment.
Something went wrong with that request. Please try again.