[tahoe-dev] Issue with Unplugging One Node from private grid
Kevin Reid
kpreid at switchb.org
Mon Nov 29 22:56:05 UTC 2010
On Nov 29, 2010, at 15:57, Brian Warner wrote:
> he first problem (which isn't the most important one) is how to detect
> non-explicit connection loss The best you can do here is a
> heuristic, by
> sending a keepalive packet every once in a while, and abandoning any
> connection that has been quiet for too long.
On Mac OS X, at least, you can monitor whether there is an active
network connection using the SCReachability API. I don't know whether
other platforms have anything similar.
http://developer.apple.com/library/mac/#documentation/Networking/
Conceptual/SystemConfigFrameworks/SC_ReachConnect/SC_ReachConnect.html
It's stupid to drop connections preemptively, of course, but you can
do better (at least heuristically) than waiting for a TCP timeout on
an existing connection. For example, if the network status goes from
'down' to 'up', do one or both of these things:
- send an explicit keepalive packet and assume the connection is dead
if there is not a prompt response
- open a second connection while keeping the first and drop the first
if the second succeeds
The latter can be thought of as selectively discarding TCP's ordering
guarantees: you want new messages to go through even if they arrive
before old messages do (or can be assumed to have failed to arrive).
(Disclaimer: I have not actually implemented any of the above anywhere.)
--
Kevin Reid <http://switchb.org/kpreid/>
More information about the tahoe-dev
mailing list