Enable TCP keepalives for early detection of severed tcp connections (issue #1)#40
Enable TCP keepalives for early detection of severed tcp connections (issue #1)#40ExploreMqt merged 5 commits intologicalparadox:masterfrom nrcmedia:keepalives
Conversation
|
A question and a request. |
This reverts commit c5da91a.
|
The revert was an error on my side. Thought I reverted a change done by a previous developer working for our company which was no longer needed. I did not notice it had been pulled upstream. Sorry for that. I reverted the revert. :) Added a commit which makes the delay configurable as requested. Not sure how to add a test for this. |
|
Just checking in. Were you planning on writing the unit tests? |
|
Added test for the sake of it. I am unable to actually reproduce/test scenarios for which this was designed, but the minimum I could do was to test that the 'keepalive delay' config var is actually being set and it accepts both strings as well as numbers (0 to disable). |
|
Have added tests as requested. Can you accept this PR in its current state or do you need something else? |
|
Sorry, I got distracted with the holidays and then forgot. |
|
I have looked at this again and again but I'm afraid I don't see what else could be tested here. Currently it tests the case of not setting the value and checking the default of '5m' in this case and the case of disabling the behaviour by setting a value of 0. Implementing the latter actually lead to discovering that the previous implementation was only accepting string values, so that test actually already proved itself somewhat. I could add another test setting yet another arbitrary value, but the thing is that I can only access set() and get() from the test so it seems kind of pointless. Computations of values passed to setKeepAlive are done by the ms module so I'd say that should be covered by the unit tests for that module, right? That said I'm more familiar with functional (black box) testing than I am with unit testing of software so I might just not get it. :-P |
Enabling TCP keepalives fixed issue #1 for us. In our case a firewall managed by our provider was silently dropping packets for TCP connections which had been idle for more than an hour. Packets could be seen piling up in the 'Send-Q' column of netstat in this case and notifications would be lost at some point when the TCP stack finally gave up and emitted an ETIMEDOUT error. TCP keepalives fool the firewall and prevent the connection from becoming idle.