Permalink
Browse files

Release v0.0.16

  • Loading branch information...
2 parents 22c4830 + ea20f26 commit f66d1f8556396861c0a21762d4243c3bc846e397 @pgte committed Oct 3, 2010
Showing with 7 additions and 9 deletions.
  1. +1 −1 TODO
  2. +6 −8 lib/fugue.js
View
2 TODO
@@ -3,7 +3,7 @@
3. Use fork() to start the workers instead of spawn
4. (DONE)unit / integration tests - any ideas on how to test fugue?
5. review the master / worker protocol for passing in the server socket
-6. review the code that synchronously tries to fetch the file descriptor from the original master into the new respawned master (lib/fugue.js lines 72 - 91) - they're a bit too hacky - try and remove the recvMsg cycle...
+6. (DONE) Review the code that synchronously tries to fetch the file descriptor from the original master into the new respawned master (lib/fugue.js lines 72 - 91) - they're a bit too hacky - try and remove the recvMsg cycle...
7. Monitor request timeouts (as Unicorn does) - only plausible for HTTP Servers, though (??)
8. (DONE) Don't hardcode path for unix socket. Make it a temporary random file and pass it around on environment?
9. Somehow delete master sockets that are not being used. This can be tricky, since master socket paths are passed around to workers and new masters.
View
@@ -142,25 +142,23 @@ exports.start = function(server, port, host, worker_count, options) {
netBinding.write(client_socket, request_buffer, 0, request_buffer.length);
var responseBuffer = new Buffer(256);
var length = null;
+ // Node returns length and sets (or not) fd by design as explained in node_net.cc / RecvMsg
do {
length = netBinding.recvMsg(client_socket, responseBuffer, 0, responseBuffer.length)
} while(!netBinding.recvMsg.fd);
log('Got response from server:' + responseBuffer.toString('ascii', 0, length));
- if (netBinding.recvMsg.fd) {
- server_socket = netBinding.recvMsg.fd;
- } else {
- log('Response got no file descriptor... (bad)');
- }
+ server_socket = netBinding.recvMsg.fd;
} catch(error) {
log('Error trying to get server file descriptor: ' + error.message);
}
+
if (!server_socket) {
log('Failed to get socket from original server.');
log('Now I\'m going to try to create one...')
}
-
}
+
if (!server_socket) {
// Now we have to create a socket
@@ -204,15 +202,15 @@ exports.start = function(server, port, host, worker_count, options) {
var spawn_worker = function(worker_idx) {
// prepare environment for worker
var env = {};
- for(var i in process.env){
+ for (var i in process.env) {
env[i] = process.env[i];
}
env._FUGUE_WORKER = "" + (worker_idx + 1);
var args = process.argv;
// spawn worker process
var new_worker = workers[worker_idx] = spawn(args[0], args.slice(1), env);
- if(!options.log_file) {
+ if (!options.log_file) {
// if worker does not log into file, pipe the worker output here
var worker_log = function(what) {
console.log("WORKER " + worker_idx + ": " + what.toString());

0 comments on commit f66d1f8

Please sign in to comment.