From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/18423 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.user Subject: Re: Transparently reconnect to servers after a system suspend Date: Sat, 15 Oct 2016 21:04:13 -0700 Message-ID: <87r37hos76.fsf@ericabrahamsen.net> References: <87bmylqzcy.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1476590697 8956 195.159.176.226 (16 Oct 2016 04:04:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Oct 2016 04:04:57 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sun Oct 16 06:04:53 2016 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bvcgi-0007w6-TH for gegu-info-gnus-english@m.gmane.org; Sun, 16 Oct 2016 06:04:41 +0200 Original-Received: from localhost ([::1]:54980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvcgf-000262-Ni for gegu-info-gnus-english@m.gmane.org; Sun, 16 Oct 2016 00:04:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvcgc-00025i-Dd for info-gnus-english@gnu.org; Sun, 16 Oct 2016 00:04:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvcgZ-0007b0-7q for info-gnus-english@gnu.org; Sun, 16 Oct 2016 00:04:34 -0400 Original-Received: from [195.159.176.226] (port=53755 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bvcgZ-0007ah-12 for info-gnus-english@gnu.org; Sun, 16 Oct 2016 00:04:31 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bvcgT-0006Xq-7i for info-gnus-english@gnu.org; Sun, 16 Oct 2016 06:04:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:UlJgN7IiiCDAFkjyi3qUe+Tt/tE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: "info-gnus-english" Xref: news.gmane.org gmane.emacs.gnus.user:18423 Archived-At: Sebastian Krause writes: > Eric Abrahamsen wrote: >> This has been annoying people for a very long time, but I don't think >> there's any clean solution to the problem. Gnus doesn't actually know >> that you've suspended and woken your computer, so it doesn't have any >> reason to suspect the connections are down. I think we'd have to ping >> servers on a timer, or maybe run a clock in lisp and periodically check >> it against system time (to see if execution was suspended for a while). >> Nothing immediately presents itself as The Right Solution, so no one's >> done anything... > > I guess The Right Solution would be if Emacs would provide access to > the operating system's sleep/wake notifications (e.g. on macOS: > https://developer.apple.com/library/content/qa/qa1340/_index.html) > and tell Gnus about a system wakeup. Gnus could then just close all > connections each time it received such a notification. But it > doesn't look like there's anything like that in Emacs. > > The second best thing I can think of is TCP keepalive with much > lower values for tcp_keepalive_time and tcp_keepalive_intvl. Gnus > actually enables :keepalive in its network sockets (e.g. in nntp.el > and nnimap.el), but the default values for the first keepalive > package on Linux and Windows is two hours of inactivity, and even > then it will take more than 10 minutes of no response until the OS > actually closes the connection. It's actually possible to lower the > keepalive parameters per socket, but again it doesn't seem like > Emacs provides the possibility to do that in elisp. You could raise both of these questions in emacs.devel and see what they say -- I don't know too much about it. My guess is that these questions have been discussed before, but I don't know off the top of my head. >> A lighter-weight solution than a full restart is using "z", for >> gnus-group-suspend. That will close all the servers, which will be >> re-opened the next time you "g". > > Weird, pressing "z" in the *Group* buffer just closes Gnus here. `gnus-group-suspend' closes all the servers *and* buries all Gnus buffers. It's lighter weight because, unlike "R", it won't have to re-read all your init files next time you get new news. I generally don't want my buffers buried, so I just use the code snippet I posted, in my own function. E