Skip to content

Commit

Permalink
Respect the response from block
Browse files Browse the repository at this point in the history
If keepalive, #connect always returns integer returned by L1104

Signed-off-by: Yuta Iwama <[email protected]>
  • Loading branch information
ganmacs committed Jun 13, 2019
1 parent 12ffa0a commit 3cacaf5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fluent/plugin/out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,9 @@ def connect(host = nil)
end

if block_given?
ret = nil
begin
yield(sock)
ret = yield(sock)
rescue
@socket_cache.revoke if @keepalive
raise
Expand All @@ -1091,6 +1092,8 @@ def connect(host = nil)
ensure
sock.close unless @keepalive
end

ret
else
sock
end
Expand Down

0 comments on commit 3cacaf5

Please sign in to comment.