Skip to content

Commit

Permalink
Merge pull request eventmachine#466 from benburkert/attach_server_sig…
Browse files Browse the repository at this point in the history
…nature

Return the signature ID from EventMachine.attach_server.
  • Loading branch information
tmm1 committed Sep 26, 2013
2 parents 89a34c7 + d587bdf commit 3203c40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/eventmachine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ def self.attach_server sock, handler=nil, *args, &block
sd = sock.respond_to?(:fileno) ? sock.fileno : sock
s = attach_sd(sd)
@acceptors[s] = [klass,args,block,sock]
s
end

# Stop a TCP server socket that was started with {EventMachine.start_server}.
Expand Down
4 changes: 3 additions & 1 deletion tests/test_attach.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def notify_readable

def test_attach_server
$before = TCPServer.new("127.0.0.1", @port)
sig = nil
EM.run {
EM.attach_server $before, EchoServer
sig = EM.attach_server $before, EchoServer

handler = Class.new(EM::Connection) do
def initialize
Expand All @@ -83,6 +84,7 @@ def initialize

assert_equal false, $before.closed?
assert_equal "hello world", $received_data
assert sig.is_a?(Integer)
end

def test_attach_pipe
Expand Down

0 comments on commit 3203c40

Please sign in to comment.