Skip to content

Commit

Permalink
use plugin.stop to return from run
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
jsvd authored and jordansissel committed Sep 21, 2015
1 parent e178bfe commit 9f40e0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 6 additions & 8 deletions lib/logstash/inputs/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,12 @@ def lowercase_keys(hash)
end

public
def teardown
if @server
@server.stop(true)
begin
@server.binder.close if @server.binder
rescue IOError
end
end
def stop
return unless @server
@server.stop(true)
@server.binder.close if @server.binder
rescue IOError
# do nothing
end

end # class LogStash::Inputs::Http
6 changes: 5 additions & 1 deletion spec/inputs/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
let(:port) { rand(5000) + 1025 }

after :each do
subject.teardown
subject.stop
end

it_behaves_like "an interruptible input plugin" do
let(:config) { { "port" => port } }
end

describe "#run" do
Expand Down

0 comments on commit 9f40e0b

Please sign in to comment.