Permalink
Browse files

Change from EINHORN_FD -> EINHORN_SOCK_FD

  • Loading branch information...
1 parent f1f5d06 commit 1295b4035c3dd2b942adafbce5675580084b4b05 @gdb gdb committed Sep 27, 2012
Showing with 8 additions and 8 deletions.
  1. +2 −2 bin/einhorn
  2. +4 −4 lib/einhorn/command.rb
  3. +2 −2 lib/einhorn/worker.rb
View
4 bin/einhorn
@@ -122,7 +122,7 @@ to the UNIX socket pointed to by the environment variable
To make things even easier, you can pass a `-b` to Einhorn, in which
case you just need to `write()` the above message to the open file
-descriptor pointed to by `EINHORN_FD`.
+descriptor pointed to by `EINHORN_SOCK_FD`.
(See `lib/einhorn/worker.rb` for details of these and other socket
discovery mechanisms.)
@@ -174,7 +174,7 @@ if true # $0 == __FILE__
Einhorn::TransientState.environ = ENV.to_hash
optparse = OptionParser.new do |opts|
- opts.on('-b', '--command-socket-as-fd', 'Leave the command socket open as a file descriptor, passed in the EINHORN_FD environment variable. This allows your worker processes to ACK without needing to know where on the filesystem the command socket lives.') do
+ opts.on('-b', '--command-socket-as-fd', 'Leave the command socket open as a file descriptor, passed in the EINHORN_SOCK_FD environment variable. This allows your worker processes to ACK without needing to know where on the filesystem the command socket lives.') do
Einhorn::State.command_socket_as_fd = true
end
View
8 lib/einhorn/command.rb
@@ -189,7 +189,7 @@ def self.spinup(cmd=nil)
Einhorn::Event.close_all_for_worker
Einhorn.set_argv(cmd, true)
- pass_command_socket_info
+ prepare_child_environment
einhorn_main
end
else
@@ -203,7 +203,7 @@ def self.spinup(cmd=nil)
# cloexec on everything.
Einhorn::Event.close_all_for_worker
- pass_command_socket_info
+ prepare_child_environment
exec [cmd[0], cmd[0]], *cmd[1..-1]
end
end
@@ -228,14 +228,14 @@ def self.spinup(cmd=nil)
end
end
- def self.pass_command_socket_info
+ def self.prepare_child_environment
# This is run from the child
ENV['EINHORN_MASTER_PID'] = Process.ppid.to_s
ENV['EINHORN_SOCK_PATH'] = Einhorn::Command::Interface.socket_path
if Einhorn::State.command_socket_as_fd
socket = UNIXSocket.open(Einhorn::Command::Interface.socket_path)
Einhorn::TransientState.socket_handles << socket
- ENV['EINHORN_FD'] = socket.fileno.to_s
+ ENV['EINHORN_SOCK_FD'] = socket.fileno.to_s
end
end
View
4 lib/einhorn/worker.rb
@@ -38,7 +38,7 @@ def self.ack(*args)
#
# @discovery: How to discover the master process's command socket.
# :env: Discover the path from ENV['EINHORN_SOCK_PATH']
- # :fd: Just use the file descriptor in ENV['EINHORN_FD'].
+ # :fd: Just use the file descriptor in ENV['EINHORN_SOCK_FD'].
# Must run the master with the -b flag. This is mostly
# useful if you don't have a nice library like Einhorn::Worker.
# Then @arg being true causes the FD to be left open after ACK;
@@ -57,7 +57,7 @@ def self.ack!(discovery=:env, arg=nil)
socket = ENV['EINHORN_SOCK_PATH']
client = Einhorn::Client.for_path(socket)
when :fd
- raise "No EINHORN_FD provided in environment. Did you run einhorn with the -b flag?" unless fd_str = ENV['EINHORN_FD']
+ raise "No EINHORN_SOCK_FD provided in environment. Did you run einhorn with the -b flag?" unless fd_str = ENV['EINHORN_SOCK_FD']
fd = Integer(fd_str)
client = Einhorn::Client.for_fd(fd)

0 comments on commit 1295b40

Please sign in to comment.