Skip to content

Commit

Permalink
Handle a nil argument to Einhorn::Worker.socket
Browse files Browse the repository at this point in the history
  • Loading branch information
gdb committed Sep 27, 2012
1 parent d83384c commit 8beadcf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions History.txt
@@ -1,3 +1,7 @@
=== 0.4.1 2012-09-27

* Handle a nil argument to Einhorn::Worker.socket

=== 0.4.0 2012-09-26

* Switch the command-socket protocol from line-oriented JSON to
Expand Down
7 changes: 5 additions & 2 deletions lib/einhorn/worker.rb
Expand Up @@ -78,12 +78,15 @@ def self.ack!(discovery=:env, arg=nil)
true
end

def self.socket(number=0)
def self.socket(number=nil)
number ||= 0
fds = einhorn_fds
fds ? fds[number] : nil
end

def self.socket!(number=0)
def self.socket!(number=nil)
number ||= 0

unless fds = einhorn_fds
raise "No EINHORN_FDS provided in environment. Are you running under Einhorn?"
end
Expand Down

0 comments on commit 8beadcf

Please sign in to comment.