unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Julien Danjou <julien@danjou.info>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Determining whether a TCP connection is up
Date: Mon, 05 Aug 2013 12:34:30 +0200	[thread overview]
Message-ID: <878v0g1l55.fsf@dex.adm.naquadah.org> (raw)
In-Reply-To: <m37gg0lwbh.fsf@stories.gnus.org> (Lars Magne Ingebrigtsen's message of "Mon, 05 Aug 2013 04:12:50 +0200")

[-- Attachment #1: Type: text/plain, Size: 1521 bytes --]

On Mon, Aug 05 2013, Lars Magne Ingebrigtsen wrote:

> Whether you have a pool of connections or kill/reconnect, the problem
> remains the same: Figuring out when to switch connections/reconnect.
>
> And in the case that the IP address changed, all your connections in the
> pool will hang, so it doesn't really help...

It would help a lot:
- connections would be stuck in the *background*, avoiding getting your
  Emacs frozen;
- connections will eventually time out (the kernel does have a TCP
  timeout), and you will be able to reschedule the operation since you
  used a queue.

Also, sqending regular NOOP command should triggers early detection of
IP changes. If I'm not mistaken, if the kernel thinks you have a TCP
session established, but your NATed public IP address changed, the
remote server is going to send you a RST or something like that as soon
as it received something, and the kernel will consider the connection as
no more valid and will close it.

That could even work for long operation:
- send a COMMAND that takes a lot of time
- change your public network IP address
- send a NOOP (seems you can do that, check
  http://tools.ietf.org/html/rfc3501#section-5.5)
  -> if the remote server doesn't know your public IP address, the
     connection will be reset; restart!
  -> if the connection's good, the server might replies now, or later
     (see RFC)

My 2c,

-- 
Julien Danjou
;; Free Software hacker ; freelance consultant
;; http://julien.danjou.info

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

  parent reply	other threads:[~2013-08-05 10:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-03 12:30 Determining whether a TCP connection is up Lars Magne Ingebrigtsen
2013-08-03 14:09 ` Paul Eggert
2013-08-03 16:01 ` Julien Danjou
2013-08-05  2:12   ` Lars Magne Ingebrigtsen
2013-08-05  2:33     ` chad
2013-08-05  2:37       ` Lars Magne Ingebrigtsen
2013-08-05 10:34     ` Julien Danjou [this message]
2013-08-05 14:40       ` Stefan Monnier
2013-08-05 15:23         ` Thierry Volpiatto
2013-08-05 15:51         ` Julien Danjou
2013-08-05 17:55       ` Lars Magne Ingebrigtsen
2013-08-06  8:51         ` Julien Danjou
2013-08-06  9:59           ` joakim
2013-08-06 13:36           ` Lars Magne Ingebrigtsen
2013-08-06 21:32             ` Stefan Monnier
2013-08-12 17:09               ` Lars Magne Ingebrigtsen
2013-08-13  1:52                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878v0g1l55.fsf@dex.adm.naquadah.org \
    --to=julien@danjou.info \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).