From 5bf30cf780befc705554a56097dee37676096a80 Mon Sep 17 00:00:00 2001 From: Ahren Stevens-Taylor Date: Mon, 30 Oct 2017 17:04:20 +0000 Subject: [PATCH 1/2] Fix for #30 --- lib/logstash/outputs/tcp.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/logstash/outputs/tcp.rb b/lib/logstash/outputs/tcp.rb index edf7d26..cae4e57 100644 --- a/lib/logstash/outputs/tcp.rb +++ b/lib/logstash/outputs/tcp.rb @@ -156,7 +156,10 @@ def register client_socket.sysread(16384) if r.any? # Now send the payload - client_socket.syswrite(payload) if w.any? + written = client_socket.syswrite(payload) if w.any? + while payload.length > written do + client_socket.syswrite(payload) if w.any? + end rescue => e @logger.warn("tcp output exception", :host => @host, :port => @port, :exception => e, :backtrace => e.backtrace) From 16e53c853a31d4d9347d81592827d003c0a0067a Mon Sep 17 00:00:00 2001 From: Ahren Stevens-Taylor Date: Mon, 30 Oct 2017 17:08:16 +0000 Subject: [PATCH 2/2] Fix everlasting while loop --- lib/logstash/outputs/tcp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logstash/outputs/tcp.rb b/lib/logstash/outputs/tcp.rb index cae4e57..3f02cb5 100644 --- a/lib/logstash/outputs/tcp.rb +++ b/lib/logstash/outputs/tcp.rb @@ -158,7 +158,7 @@ def register # Now send the payload written = client_socket.syswrite(payload) if w.any? while payload.length > written do - client_socket.syswrite(payload) if w.any? + written += client_socket.syswrite(payload) if w.any? end rescue => e @logger.warn("tcp output exception", :host => @host, :port => @port,