Przeglądaj źródła

Fix errors by having worker ID global, and make responses strings.

Bentley James Oakes 7 lat temu
rodzic
commit
27dea96f65
2 zmienionych plików z 5 dodań i 2 usunięć
  1. 4 1
      __worker.js
  2. 1 1
      httpwsd.js

+ 4 - 1
__worker.js

@@ -114,8 +114,11 @@ var  _util 	= require('util'),
 	 _mmmk,
 	 _mt,
 	 _plugins,
-	 __wid,
 	 __wtype;
+
+//have worker id global so that workers can detect it when loaded
+global.__wid = null;
+
 var keepaliveAgent = new _http.Agent({keepAlive: true, maxSockets: 10, maxFreeSockets: 5}); // proposed by yentl to improve performance
 
 

+ 1 - 1
httpwsd.js

@@ -38,7 +38,7 @@ function __respond(response, statusCode, reason, data, headers)
 {
 	response.writeHead(
 			statusCode,
-			reason,
+			JSON.stringify(reason),
 			(headers || {'Content-Type': 'text/plain'}));
 
 	var encoding =