Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #39 from halorgium/cleanup-guards
Browse files Browse the repository at this point in the history
Server#finalize fails if the socket was unable to be created
  • Loading branch information
tarcieri committed Apr 7, 2013
2 parents ae610ec + c28fb1a commit 86044e1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/reel/app.rb
Expand Up @@ -27,7 +27,7 @@ def status_symbol(status)
end

def terminate
@server.terminate
@server.terminate if @server
end
end
end
2 changes: 1 addition & 1 deletion lib/reel/server.rb
Expand Up @@ -17,7 +17,7 @@ def initialize(host, port, backlog = DEFAULT_BACKLOG, &callback)
end

def finalize
@server.close
@server.close if @server
end

def run
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -15,7 +15,7 @@ def with_reel(handler)
server = Reel::Server.new(example_addr, example_port, &handler)
yield server
ensure
server.terminate
server.terminate if server
end

def with_socket_pair
Expand Down

0 comments on commit 86044e1

Please sign in to comment.