From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Olson Newsgroups: gmane.emacs.bugs Subject: bug#18527: [Erc-discuss] bug#18527: 24.3; ERC does not reconnect when server disconnects me Date: Mon, 28 Dec 2015 10:29:37 -0800 Message-ID: References: <87io3jbp4s.fsf@gnus.org> <87vb7itot1.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c08851eee15c50527f97dba X-Trace: ger.gmane.org 1451327484 25686 80.91.229.3 (28 Dec 2015 18:31:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Dec 2015 18:31:24 +0000 (UTC) Cc: 18527@debbugs.gnu.org, Robert Brown To: ERC Discussion Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 28 19:31:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1aDcZc-0002pH-K3 for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 19:31:13 +0100 Original-Received: from localhost ([::1]:45798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDcZb-0000Zi-SX for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 13:31:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDcZV-0000YV-Ml for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 13:31:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDcZS-0003IL-15 for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 13:31:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDcZR-0003IF-Td for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 13:31:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aDcZR-0007A2-Mo for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 13:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Olson Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Dec 2015 18:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18527 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18527-submit@debbugs.gnu.org id=B18527.145132740527395 (code B ref 18527); Mon, 28 Dec 2015 18:31:01 +0000 Original-Received: (at 18527) by debbugs.gnu.org; 28 Dec 2015 18:30:05 +0000 Original-Received: from localhost ([127.0.0.1]:46674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDcYW-00077n-O4 for submit@debbugs.gnu.org; Mon, 28 Dec 2015 13:30:05 -0500 Original-Received: from mail-yk0-f180.google.com ([209.85.160.180]:36841) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDcYU-00076r-5T for 18527@debbugs.gnu.org; Mon, 28 Dec 2015 13:30:03 -0500 Original-Received: by mail-yk0-f180.google.com with SMTP id v14so17300607ykd.3 for <18527@debbugs.gnu.org>; Mon, 28 Dec 2015 10:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mwolson-org.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=DKqAbZFN+8rRYDrYGjzrL2pd4QC+rJl6XNa+XejOXsk=; b=E7pYrneYp/TDxUfdRH8lHjOE9y/fqbO7OIh0lX1E/raC40SX5nxkFy2ZaE0BmpMRis zCNcHj9oDRcK+X2dMbFnNpZ2bq1DCI6r8lHVCO3TDakE+y6xYP5aXfZ4tfVGCFdGLG9H vtxznxbseWqwrhg3+wCakK9wRR+Ng5WgIy7wezomH8GygxTzr4dXZSNj/HedrdKH+qWu pU6VhtyxZHC+E8pM4RJYVj/nUzyI3ioY5ji++wmmJFsy91HAOUsyfi+uExpkzRjxIvsl NfQLGJ2zfUtegRwL6u3xzj06MiQcUmd3hC8g/gAFb929jklIfxJ//7oAZe3xRkW6XAe/ hcrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=DKqAbZFN+8rRYDrYGjzrL2pd4QC+rJl6XNa+XejOXsk=; b=faHi2lwbbA17yN+LPq0rZhBxXPNk5yrYvdrcrbkaMuZbSdBg6h4uNe9+3PazpwTsfz /3wEiCoV7QGlZvr8DV93OQagy3zX1opZ9rYpVzFWF4ZK7ph1PYBJseu2vCUBT3xCe42H xe7IXwi8me51N9lkh2fwoIwQMHIqmc+JHAIP0P79Nf4iTsY2sGd8ZNRU2su3LiXwVd1F R07mbR1sazTKviVhpX9w96CVzfwtR5a8/Owv2cDnaf5dsn8pXuyb4Eznod5ABRfwMgbY 2uVpJ2af3HIiTOxlgzOmTyULSN9fZQfYuKixMS8Kn30uXpfVH0XDQ41VEW4AIqb8MtYT OPOw== X-Gm-Message-State: ALoCoQmT8FPJgzIDYWDZpX5jmHG3bSA37gHFhipHfDPmSOqpOULDCKwRzFKPPwjPuDd5GPiatsqzZFp17CakdRzsHcAGPGLOQQ== X-Received: by 10.13.237.129 with SMTP id w123mr40778859ywe.319.1451327396635; Mon, 28 Dec 2015 10:29:56 -0800 (PST) Original-Received: by 10.37.106.194 with HTTP; Mon, 28 Dec 2015 10:29:37 -0800 (PST) X-Originating-IP: [71.145.239.37] In-Reply-To: <87vb7itot1.fsf@gnus.org> X-Google-Sender-Auth: _Coy5-1hN4oNUw9rCKxxcpVJu1E X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:110909 Archived-At: --94eb2c08851eee15c50527f97dba Content-Type: text/plain; charset=UTF-8 Removing that line seems OK to me. On Mon, Dec 28, 2015 at 10:23 AM, Lars Ingebrigtsen wrote: > Robert Brown writes: > > > Thanks for getting back to me about this issue. It's been several > > months since I reported the reconnection problem. I have been > > able to work around it by setting erc-server-error-occurred to nil > > in a disconnect hook: > > > > (add-hook 'erc-disconnected-hook > > #'(lambda (nick host-name reason) > > ;; Re-establish the connection even if the server closed > it. > > (setq erc-server-error-occurred nil))) > > > > So yes, when the root cause of the disconnection is a server error, > > erc-server-error-occurred is set to true and the reconnect logic > > in erc-server-reconnect-p is bypassed ... so reconnection does not > > happen. > > > > In the example I sent you, I believe the server closed the connection > > and erc-server-error-occurred was set to true because of a ping > > timeout. > > > > I would prefer that erc-server-reconnect-p not check > > erc-server-error-occurred so that reconnection can happen even > > if the cause of the disconnect was a server error. > > I think that sounds reasonable, but there may be reasons for that logic. > I've Cc'd the erc mailing list to see whether they have any comments... > > This is the function that determines whether to reconnect, and the > suggestion is to remove the line about erc-server-error-occurred: > > (defsubst erc-server-reconnect-p (event) > "Return non-nil if ERC should attempt to reconnect automatically. > EVENT is the message received from the closed connection process." > (or erc-server-reconnecting > (and erc-server-auto-reconnect > (not erc-server-banned) > (not erc-server-error-occurred) > ;; make sure we don't infinitely try to reconnect, unless the > ;; user wants that > (or (eq erc-server-reconnect-attempts t) > (and (integerp erc-server-reconnect-attempts) > (< erc-server-reconnect-count > erc-server-reconnect-attempts))) > (or erc-server-timed-out > (not (string-match "^deleted" event))) > ;; open-network-stream-nowait error for connection refused > (if (string-match "^failed with code 111" event) 'nonblocking > t)))) > > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no > > _______________________________________________ > Erc-discuss mailing list > Erc-discuss@gnu.org > https://lists.gnu.org/mailman/listinfo/erc-discuss > --94eb2c08851eee15c50527f97dba Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Removing that line seems OK to me.

On Mon, Dec 28, 2015 at 10:23 AM, L= ars Ingebrigtsen <larsi@gnus.org> wrote:
Robert Brown <ro= bert.brown@gmail.com> writes:

> Thanks for getting back to me about this issue.=C2=A0 It's been se= veral
> months since I reported the reconnection problem.=C2=A0 I have been > able to work around it by setting erc-server-error-occurred to nil
> in a disconnect hook:
>
> (add-hook 'erc-disconnected-hook
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'(lambda (nick host-name = reason)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Re-establish = the connection even if the server closed it.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq erc-server= -error-occurred nil)))
>
> So yes, when the root cause of the disconnection is a server error, > erc-server-error-occurred is set to true and the reconnect logic
> in erc-server-reconnect-p is bypassed ... so reconnection does not
> happen.
>
> In the example I sent you, I believe the server closed the connection<= br> > and erc-server-error-occurred was set to true because of a ping
> timeout.
>
> I would prefer that erc-server-reconnect-p not check
> erc-server-error-occurred so that reconnection can happen even
> if the cause of the disconnect was a server error.

I think that sounds reasonable, but there may be reasons for that logic. I've Cc'd the erc mailing list to see whether they have any comment= s...

This is the function that determines whether to reconnect, and the
suggestion is to remove the line about erc-server-error-occurred:

(defsubst erc-server-reconnect-p (event)
=C2=A0 "Return non-nil if ERC should attempt to reconnect automaticall= y.
EVENT is the message received from the closed connection process."
=C2=A0 (or erc-server-reconnecting
=C2=A0 =C2=A0 =C2=A0 (and erc-server-auto-reconnect
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not erc-server-banned)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not erc-server-error-occurred) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; make sure we don't infinite= ly try to reconnect, unless the
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; user wants that
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(or (eq erc-server-reconnect-attem= pts t)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and (integerp erc-s= erver-reconnect-attempts)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (<= erc-server-reconnect-count
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0erc-server-reconnect-attempts)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(or erc-server-timed-out
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not (string-match &= quot;^deleted" event)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; open-network-stream-nowait erro= r for connection refused
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (string-match "^failed wi= th code 111" event) 'nonblocking t))))


--
(domestic pets only, the antidote for overdose, milk.)
=C2=A0 =C2=A0bloggy blog: http://lars.ingebrigtsen.no

_______________________________________________
Erc-discuss mailing list
Erc-discuss@gnu.org
https://lists.gnu.org/mailman/listinfo/erc-discuss=

--94eb2c08851eee15c50527f97dba--