Skip to content

Commit

Permalink
Merge pull request #197 from headius/no_double_interrupt_test_server
Browse files Browse the repository at this point in the history
Don't double-interrupt the test HTTP server
  • Loading branch information
hsbt authored Dec 31, 2024
2 parents 0b60ca6 + 54025b3 commit e18aa61
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/net/http/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ def initialize(config, &block)
def start
@thread = Thread.new do
loop do
socket = @ssl_server ? @ssl_server.accept : @server.accept
socket = (@ssl_server || @server).accept
run(socket)
rescue
ensure
socket.close if socket
socket&.close
end
ensure
(@ssl_server || @server).close
end
end

Expand All @@ -42,7 +44,6 @@ def run(socket)

def shutdown
@thread&.kill
@server&.close
@thread&.join
end

Expand Down

0 comments on commit e18aa61

Please sign in to comment.