Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnection capability and fail fast TCP connection #51

Closed
wants to merge 2 commits into from

Conversation

rasjoh
Copy link

@rasjoh rasjoh commented Jun 28, 2017

Improve connection robustness (reconnects)
Added TCP_TIMEOUT parameter to be able to fail the connection fast in case of an unplanned outage of the connection recipient

conn.SetKeepAlivePeriod(1*time.Second)
conn.SetNoDelay(true)
conn.SetWriteDeadline(tcp_timeout)
a.conn = conn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't have to set the conn again here, right?

@@ -155,16 +158,38 @@ func (a *LogstashAdapter) Stream(logstream chan *router.Message) {
js = append(js, byte('\n'))

for {
_, err := a.conn.Write(js)
if a.route.AdapterTransport(a.route.Adapter) == "tcp" && os.Getenv("TCP_TIMEOUT") != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the impacts of checking this for every Write?

@maxekman
Copy link
Member

Thanks for tackling the issues!

@maxekman
Copy link
Member

@rasjoh It would be great if the questions could be answered. (Also needs a rebase after merging the last PR)

@maxekman
Copy link
Member

Closing due to lack of response.

@maxekman maxekman closed this Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants