Skip to content

Commit 9eadbe4

Browse files
Ensuring that an entire message has been sent by calling SSLSocket/TCPSocket.syswrite in loop.
Fixes logstash-plugins#30 logstash-plugins#33 where messages longer than jruby-openssl OpenSSL::Buffering::BLOCK_SIZE were truncated.
1 parent 57c8797 commit 9eadbe4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: lib/logstash/outputs/tcp.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ def register
158158
client_socket.sysread(16384) if r.any?
159159

160160
# Now send the payload
161-
client_socket.syswrite(payload) if w.any?
161+
if w.any?
162+
while payload.bytesize > 0
163+
written = client_socket.syswrite(payload)
164+
payload = payload.byteslice(written..-1)
165+
end
166+
end
162167
rescue => e
163168
@logger.warn("tcp output exception", :host => @host, :port => @port,
164169
:exception => e, :backtrace => e.backtrace)

Diff for: logstash-output-tcp.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-output-tcp'
4-
s.version = '6.0.0'
4+
s.version = '6.0.1'
55
s.licenses = ['Apache License (2.0)']
66
s.summary = "Writes events over a TCP socket"
77
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"

0 commit comments

Comments
 (0)