From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 28475 invoked from network); 1 May 2020 20:52:05 -0000 Received: from lists1.math.uh.edu (129.7.128.208) by inbox.vuxu.org with ESMTPUTF8; 1 May 2020 20:52:05 -0000 Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.92.3) (envelope-from ) id 1jUcd7-0006j0-FV; Fri, 01 May 2020 15:51:29 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jUcd2-0006gG-Ru for ding@lists.math.uh.edu; Fri, 01 May 2020 15:51:24 -0500 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jUcd1-0003zq-22 for ding@lists.math.uh.edu; Fri, 01 May 2020 15:51:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uMNpgz7fTB/T4mdjSH2SQmGgHQj62uSpFdOgNFQnIUY=; b=Lbtl3IswCmWL9A6EQyd90RCVdF UCqDWlJy9ulWtD6bmGszpkNoQx+W6Ulyi8dyvcaIATgAkp3H33JmqYQPMjuxus/yfqHJrIAANvMYz jWn13bZu5jUqUVIc6xS2MUnX5uZEJ2Es0Tz/gh9q/F7J0HFU/vRbF7oKiG5Q4qLs+yFc=; Received: from zplane.randomsample.de ([2a03:4000:42:1a1:9400:eeff:feb4:c8a0]) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUccs-0008DI-Fm; Fri, 01 May 2020 22:51:18 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uMNpgz7fTB/T4mdjSH2SQmGgHQj62uSpFdOgNFQnIUY=; b=ZTsOZbTfZUiRnY7fxw3ENkX7c Ov/CODPTydvcVrjFC9sX04YcLgpSNd07WHdxctrWKgHxYUskqSNzP/Z/idIGzwY8pOnkruAcOilxL 4/3cCKQ/5g03VdP7f3pJIq0Zv4kM2figRNhCgj6VNa9gfBweOP3rS0/co4gD23mwtsOWh0bjsyesA Yo5Ap3R7pj0ESr3mF6xeiJH+RQmZCNx8rKf3/qM+/NBs4oa3EeVA1omOU2DBBkLuYg+FsrlV5lJho JnvbPmKMdubx38yBFsQx+s+QsV4yKKRtkcLnaJqv5Sr+B7VvnJDE8lsrjSzlunjqVZc8uYePH4Dgy EVCMPIWhg==; Received: from [95.90.186.238] (helo=void) by zplane.randomsample.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUccq-0005Bo-Lr; Fri, 01 May 2020 22:51:12 +0200 From: David Engster To: Eric Abrahamsen Cc: Lars Ingebrigtsen , ding@gnus.org Subject: Re: new wifi connection = nntp timeout = Emacs restart? In-Reply-To: <87sggja7hv.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Fri, 01 May 2020 10:29:48 -0700") References: <87sgh3coxn.fsf@ericabrahamsen.net> <87o8rogew7.fsf@barthel.ch> <87zhb7mlf0.fsf@ericabrahamsen.net> <87a72t35ng.fsf@gnus.org> <87sggkeuvr.fsf@ericabrahamsen.net> <874kt01w30.fsf@gnus.org> <87r1w4boft.fsf@ericabrahamsen.net> <877dxwzjz6.fsf@gnus.org> <87mu6sbntb.fsf@ericabrahamsen.net> <87368kziq4.fsf@gnus.org> <87h7x0bm8p.fsf@ericabrahamsen.net> <87y2qcy2vb.fsf@gnus.org> <87mu6sc7hz.fsf@randomsample> <87imhgc58s.fsf@randomsample> <87sggja7hv.fsf@ericabrahamsen.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Mail-Copies-To: never Date: Fri, 01 May 2020 22:51:12 +0200 Message-ID: <87d07ncrb3.fsf@randomsample> MIME-Version: 1.0 Content-Type: text/plain List-ID: Precedence: bulk > Hey, that's pretty handy! Just FYI, the function name is quoted > unnecessarily Oops... > and sleep-start is actually nil when it's going to sleep, > who knows why. Uhm, not for me. I just tested again to make sure. On sleep it is 't', on wakup it is nil. This is also the documented behavior: The PrepareForShutdown() resp. PrepareForSleep() signals are sent right before (with the argument True) and after (with the argument False) the system goes down for reboot/poweroff, resp. suspend/hibernate. https://www.freedesktop.org/wiki/Software/systemd/logind/ > Particularly handy since, in all my years of using dbus machines, I have > never managed to write a dbus rule that did anything other than fail > silently. This is useful. You can actually do pretty nifty things with DBus, but it's... well, let's say: convoluted. But Michael Albinus has really done a great job for the Emacs interface, it's really simple to use and well documented. As for detecting networking changes, I don't think it is possible to do this with the systemd networking.service only, you'll also need NetworkManager. I tried NetworkManager years ago and it was... really not good. I just tried it again today and was happily surprised how well it works nowadays. Some things just need time. So NetworkManager will tell you everything you need to know via DBus: https://developer.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.html So from that I guess checking for changes on 'State' makes the most sense? (defun my-network-state-handler (name change-vals change-novals) (let ((state (assoc "State" change-vals))) (when state (message "New State: %s" (caadr state))))) (dbus-register-signal :system "org.freedesktop.Networkmanager" "/org/freedesktop/NetworkManager" "org.freedesktop.DBus.Properties" "PropertiesChanged" 'my-network-state-handler) So if you evaluate this and put your network down, you should see something like New State: 30 New State: 20 And if you put it up again: New State: 40 New State: 50 New State: 60 New State: 70 The numbers are explained here: https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMState So from that I guess we should just call gnus-close-all-servers for state=30: Network connections are being cleaned up. The applications should tear down their network sessions. -David