Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rvm:
- 2.3.0
- 2.4.0
- jruby-19mode
before_install: gem install bundler -v "< 2"
deploy:
provider: rubygems
api_key:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ DEPENDENCIES
test-unit (~> 3.2.0)

BUNDLED WITH
1.14.6
1.17.3
8 changes: 6 additions & 2 deletions lib/gelf/transport/tcp.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module GELF
module Transport
class TCP
IO_TIMEOUT = 10 # IO timeout in seconds

attr_reader :addresses

# `addresses` Array of [host, port] pairs
Expand Down Expand Up @@ -60,14 +62,16 @@ def write_socket(socket, message)
end

def unsafe_write_socket(socket, message)
r,w = IO.select([socket], [socket])
r, w = IO.select([socket], [socket], [], IO_TIMEOUT)
return false unless r

# Read everything first
while r.any? do
# don't expect any reads, but a readable socket might
# mean the remote end closed, so read it and throw it away.
# we'll get an EOFError if it happens.
socket.sysread(16384)
r = IO.select([socket])
r = IO.select([socket], [], [], IO_TIMEOUT) or break
end

# Now send the payload
Expand Down