mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Support data_timeout of -1, which never times out.
This commit is contained in:
parent
071236f5e5
commit
c4789a1cec
1 changed files with 6 additions and 1 deletions
|
@ -19,6 +19,7 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
|
|||
# Read timeout in seconds. If a particular tcp connection is
|
||||
# idle for more than this timeout period, we will assume
|
||||
# it is dead and close it.
|
||||
# If you never want to timeout, use -1.
|
||||
config :data_timeout, :validate => :number, :default => 5
|
||||
|
||||
public
|
||||
|
@ -41,8 +42,12 @@ class LogStash::Inputs::Tcp < LogStash::Inputs::Base
|
|||
# NOTE(petef): the timeout only hits after the line is read
|
||||
# or socket dies
|
||||
# TODO(sissel): Why do we have a timeout here? What's the point?
|
||||
Timeout::timeout(@data_timeout) do
|
||||
if @data_timeout == -1
|
||||
buf = s.readline
|
||||
else
|
||||
Timeout::timeout(@data_timeout) do
|
||||
buf = s.readline
|
||||
end
|
||||
end
|
||||
e = self.to_event(buf, "tcp://#{@host}:#{@port}/client/#{peer}")
|
||||
if e
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue