Skip to content

Commit

Permalink
Use at_exit instead of overriding trap for interrup to shutdown Proxy…
Browse files Browse the repository at this point in the history
…Server, AuthenticatedProxyServer.

Call to trap replaces handler for specified signal,
so ProxyServer.shutdown would have never been called.
at_exit registers handler for execution when the programm
exits, handlers are executed in revers order of registration.
  • Loading branch information
olegkovalenko committed Jan 18, 2015
1 parent 24428d2 commit 06af507
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions spec/support/proxy_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@
:RequestCallback => handler
)

Thread.new { ProxyServer.start }
trap("INT") do
ProxyServer.shutdown
exit
end
Thread.new { ProxyServer.start }
at_exit { ProxyServer.shutdown }

Thread.new { AuthenticatedProxyServer.start }
trap("INT") do
AuthenticatedProxyServer.shutdown
exit
end
Thread.new { AuthenticatedProxyServer.start }
at_exit { AuthenticatedProxyServer.shutdown }

0 comments on commit 06af507

Please sign in to comment.