From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julien Danjou Newsgroups: gmane.emacs.devel Subject: Re: Determining whether a TCP connection is up Date: Mon, 05 Aug 2013 12:34:30 +0200 Message-ID: <878v0g1l55.fsf@dex.adm.naquadah.org> References: <87txj64vbx.fsf@dex.adm.naquadah.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1375698912 20539 80.91.229.3 (5 Aug 2013 10:35:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Aug 2013 10:35:12 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 05 12:35:15 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V6I8A-00047i-L2 for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2013 12:35:14 +0200 Original-Received: from localhost ([::1]:55720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6I8A-0002Pd-5e for ged-emacs-devel@m.gmane.org; Mon, 05 Aug 2013 06:35:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6I81-0002Eo-Ua for emacs-devel@gnu.org; Mon, 05 Aug 2013 06:35:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6I7w-0000Wd-QU for emacs-devel@gnu.org; Mon, 05 Aug 2013 06:35:05 -0400 Original-Received: from prometheus.naquadah.org ([91.121.37.122]:52200 helo=mx1.naquadah.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6I7w-0000WS-KW for emacs-devel@gnu.org; Mon, 05 Aug 2013 06:35:00 -0400 Original-Received: from dex.adm.naquadah.org (lns-bzn-21-82-64-77-148.adsl.proxad.net [82.64.77.148]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mx1.naquadah.org (Postfix) with ESMTPSA id 49FBAE0168; Mon, 5 Aug 2013 12:34:43 +0200 (CEST) Mail-Followup-To: Lars Magne Ingebrigtsen , emacs-devel@gnu.org In-Reply-To: (Lars Magne Ingebrigtsen's message of "Mon, 05 Aug 2013 04:12:50 +0200") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 91.121.37.122 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162429 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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: =2D connections would be stuck in the *background*, avoiding getting your Emacs frozen; =2D 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: =2D send a COMMAND that takes a lot of time =2D change your public network IP address =2D 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, =2D-=20 Julien Danjou ;; Free Software hacker ; freelance consultant ;; http://julien.danjou.info --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAEBAgAGBQJR/3+2AAoJEGEbqVCLeKXCmjMP/i5/p87aCXiRVNdZWkcUjPdg 4bajcEQEF1D48OklxX7eYjlVYOF0oNuRX80+eN7Qx4/kK1eswXTEaUfUhwry0V3u CYNmm7Dywy983knKu0nYPfhbVGhnQtfL5FGDD0Nda+I6ysGux9wbfYO7oyH64z5l ECNwdeWSxfJmMZnWplXmPbeMKzTJPfeFU2xupbMCJvV/mLHGAQFEAjGkjgSOqDgx 2HgbOsKIe2t/kQl3F3zgxvDCqdO9tWGTfevEa/ThD/7xWzYkRRyxtQZxNWjfrxZ/ 0ae+pKxYiX+iO8KcKw6j3d+/+ZBvQ1oo+X+WErwn+a44wJ11U4BoEYLaSaJrcoDA eQtFFWP7ktzvQu1jbEEnXFPyF1ASthEQmqF4aMJyZLPvUEEs6SxChsgKYOGfAwaQ ve1XEDvQB4tJBUMSO3BJQkP/EnAZj3Kx7u9fU1UCW0pFkwM+VGZEl4Anrtr5RbtW M9RQYyLMdsyeHCLV73G2bEvmBw+DhfLM5x/ti9uKc/w9vgwbo05/ahQmRFkEy/w0 rrnU1kJeSYR8WA0+joXZ6Qu9oZN7tbvnkbdsfeKpX7IMb+OgmX+G3kpmNrP4KhBz FFt+SYMKAAXGo8uk3dUOip8ko8v6qUkmx8EwJXFpwvGAhdZ6s/YTHVdkX7YyHF+y SkF4038iZmBYlbv8Zqk4 =2pDV -----END PGP SIGNATURE----- --=-=-=--