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

we may have received a tcp FIN. in such case we should establish a new connection. #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AmirWiener
Copy link

If the syslog server have closed the connection it will send a TCP FIN. Current ensureSyslogServerConnection() implementation only check the socket state. Those checks don't cover the TCP FIN case.
In order to check it, we should try and read from the socket. If a FIN was sent, read() will return -1.
In such case we should mark the socket as invalid, and reconnect. If we won't, the next message we'll send will be rejected with a RST. No exception thrown outside to the caller, and no indication that the message was lost.

to reproduce:

  1. send a message (tcp handshake)
  2. stop and re start the syslog server (server send FIN)
  3. send a message (rejected with RST, no exception in the caller side)

…w connection.

If the syslog server have closed the connection it will send a TCP FIN.
Current ensureSyslogServerConnection() implementation only check the socket state.
Those checks don't cover the TCP FIN case.
In order to check it, we should try and read from the socket.
If a FIN was sent, read() will return -1.
In such case we should mark the socket as invalid, and reconnect.
If we won't, the next message we'll send will be rejected with a RST.
No exception thrown outside to the caller, and no indication that the message was lost.
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.

1 participant