1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

Don't recurse in erc-server-delayed-check-reconnect

* lisp/erc/erc-backend.el (erc-server-delayed-check-reconnect): Run
`reschedule' function on a timer to avoid growing the stack when
calling `delete-process'.
* lisp/erc/erc-common.el (erc--favor-changed-reverted-modules-state):
Fix `pcase' condition so that changing an option to its standard value
does not earn a "STANDARD" label in Customize if that value differs
from the saved one.
* lisp/erc/erc.el (erc-open-socks-tls-stream): Reword doc string.
* test/lisp/erc/erc-tests.el (erc--with-dependent-type-match)
(erc--with-dependent-type-match): Remove useless tests (bug#71178).
* test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld:
Await phantom EOFs and PINGs to somewhat account for a race that can
result in a failure when running the suite in parallel with -jN.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--print-trace): Set `debug-on-error' to t
so that errors in timers always trigger test failures.
;; * test/lisp/erc/resources/base/assoc/reconplay/foonet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/base/upstream-reconnect/soju-barnet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/base/mask-target-routing/foonet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/join/network-id/barnet.eld: Timeout.
This commit is contained in:
F. Jason Park 2024-05-28 00:32:13 -07:00
parent ec8c0b0d0d
commit 50b134c4dc
10 changed files with 24 additions and 44 deletions

View File

@ -885,7 +885,7 @@ Expect BUFFER to be the server buffer for the current connection."
(time-convert nil 'integer))))
((or "connection broken by remote peer\n"
(rx bot "failed"))
(funcall reschedule proc)))))
(run-at-time nil nil reschedule proc)))))
(filter (lambda (proc _)
(delete-process proc)
(with-current-buffer buffer

View File

@ -191,7 +191,7 @@ widget runs its set function.")
"Be more nuanced in displaying Custom state of `erc-modules'.
When `customized-value' differs from `saved-value', allow widget
to behave normally and show \"SET for current session\", as
though `customize-set-variable' or similar had been applied.
though `customize-set-variable' or similar has been applied.
However, when `customized-value' and `standard-value' match but
differ from `saved-value', prefer showing \"CHANGED outside
Customize\" to prevent the widget from seeing a `standard'
@ -207,7 +207,7 @@ instead of a `set' state, which precludes any actual saving."
(funcall (get 'erc-modules 'custom-set) 'erc-modules
(funcall op (erc--normalize-module-symbol name) erc-modules))
(when (equal (pcase (get 'erc-modules 'saved-value)
(`((quote ,saved) saved)))
(`((quote ,saved)) saved))
erc-modules)
(customize-mark-as-set 'erc-modules)))

View File

@ -2951,15 +2951,16 @@ PARAMETERS should be a sequence of keywords and values, per
(defun erc-open-socks-tls-stream (name buffer host service &rest parameters)
"Connect to an IRC server via SOCKS proxy over TLS.
Defer to the `socks' and `gnutls' libraries to make the actual
connection and perform TLS negotiation. Expect SERVICE to be a
TLS port number and that the plist PARAMETERS contains a
`:client-certificate' pair when necessary. Otherwise, assume the
arguments NAME, BUFFER, and HOST to be acceptable to
`open-network-stream' and that users know to check out
`erc-server-connect-function' and Info node `(erc) SOCKS' for
more info, including an important example of how to \"wrap\" this
function with SOCKS credentials."
Perform the duties required of an `erc-server-connect-function'
implementer, and return a network process. Defer to the `socks'
and `gnutls' libraries to make the connection and handle TLS
negotiation. Expect SERVICE to be a TLS port number and
PARAMETERS to be a possibly empty plist containing items like a
`:client-certificate' pair. Pass NAME, BUFFER, and HOST directly
to `open-network-stream'. Beyond that, operate as described in
Info node `(erc) SOCKS', and expect users to \"wrap\" this
function with `let'-bound credentials when necessary, as shown in
the example."
(require 'gnutls)
(require 'socks)
(let ((proc (socks-open-network-stream name buffer host service))

View File

@ -164,15 +164,6 @@
(advice-remove 'buffer-local-value 'erc-with-server-buffer)))
(ert-deftest erc--with-dependent-type-match ()
(should (equal (macroexpand-1
'(erc--with-dependent-type-match (repeat face) erc-match))
'(backquote-list*
'repeat :match (lambda (w v)
(require 'erc-match)
(widget-editable-list-match w v))
'(face)))))
(ert-deftest erc--doarray ()
(let ((array "abcdefg")
out)
@ -1269,23 +1260,6 @@
(should-not (erc--valid-local-channel-p "#chan"))
(should (erc--valid-local-channel-p "&local")))))
;; FIXME remove this because it serves no purpose. See bug#71178.
(ert-deftest erc--restore-initialize-priors ()
(unless (>= emacs-major-version 28)
(ert-skip "Lisp nesting exceeds `max-lisp-eval-depth'"))
(should (pcase (macroexpand-1 '(erc--restore-initialize-priors erc-my-mode
foo (ignore 1 2 3)
bar #'spam
baz nil))
(`(let* ((,p (or erc--server-reconnecting erc--target-priors))
(,q (and ,p (alist-get 'erc-my-mode ,p))))
(unless (local-variable-if-set-p 'erc-my-mode)
(error "Not a local minor mode var: %s" 'erc-my-mode))
(setq foo (if ,q (alist-get 'foo ,p) (ignore 1 2 3))
bar (if ,q (alist-get 'bar ,p) #'spam)
baz (if ,q (alist-get 'baz ,p) nil)))
t))))
(ert-deftest erc--target-from-string ()
(should (equal (erc--target-from-string "#chan")
#s(erc--target-channel "#chan" \#chan nil)))

View File

@ -33,7 +33,7 @@
(0.0 ":***!znc@znc.in PRIVMSG #chan :Playback Complete.")
(0.0 ":irc.foonet.org 305 tester :You are no longer marked as being away"))
((mode 3 "MODE #chan")
((mode-chan 10 "MODE #chan")
(1.0 ":irc.foonet.org 324 tester #chan +nt")
(0.0 ":irc.foonet.org 329 tester #chan 1623816901")
(0.1 ":alice!~u@mw6kegwt77kwe.irc PRIVMSG #chan :bob: At thy good heart's oppression.")

View File

@ -17,7 +17,7 @@
(0 ":irc.foonet.org 266 tester 4 4 :Current global users 4, max 4")
(0 ":irc.foonet.org 422 tester :MOTD File is missing"))
((mode-user 1.2 "MODE tester +i")
((mode-user 10 "MODE tester +i")
;; No mode answer
(0 ":irc.znc.in 306 tester :You have been marked as being away")
(0 ":tester!~u@gq7yjr7gsu7nn.irc JOIN #foo")

View File

@ -1,4 +1,8 @@
;; -*- mode: lisp-data; -*-
((~eof 60 EOF))
((~ping 60 "PING"))
((nick 10 "NICK tester"))
((user 10 "USER user 0 * :tester")
(0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")

View File

@ -10,13 +10,13 @@
(0.22 ":soju.im 221 tester +Zi")
(0.00 ":soju.im 422 tester :Use /motd to read the message of the day"))
((mode 5 "MODE tester +i")
((mode-tester 5 "MODE tester +i")
(0.00 ":tester!tester@10.0.2.100 JOIN #chan")
(0.06 ":soju.im 353 tester = #chan :tester @mike joe")
(0.01 ":soju.im 366 tester #chan :End of /NAMES list")
(0.23 ":irc.barnet.org 221 tester +Zi"))
((mode 5 "MODE #chan")
((mode-chan-a 5 "MODE #chan")
(0.00 ":soju.im 324 tester #chan +tn")
(0.01 ":soju.im 329 tester #chan 1652878846")
(0.01 ":joe!~u@6d9pasqcqwb2s.irc PRIVMSG #chan :mike: There is five in the first show.")
@ -49,7 +49,7 @@
;; Server-initialed join
(0.01 ":tester!tester@10.0.2.100 JOIN #chan"))
((mode 5 "MODE #chan")
((mode-chan-b 5 "MODE #chan")
(0.22 ":soju.im 353 tester = #chan :@mike joe tester")
(0.00 ":soju.im 366 tester #chan :End of /NAMES list")
(0.00 ":soju.im 324 tester #chan +nt")

View File

@ -144,6 +144,7 @@
(quit . ,(erc-quit/part-reason-default))
(erc-version . ,erc-version)))
(erc-modules (copy-sequence erc-modules))
(debug-on-error t)
(inhibit-interaction noninteractive)
(auth-source-do-cache nil)
(timer-list (copy-sequence timer-list))

View File

@ -1,5 +1,5 @@
;; -*- mode: lisp-data; -*-
((pass 2 "PASS :barnet:changeme"))
((pass 10 "PASS :barnet:changeme"))
((nick 2 "NICK tester"))
((user 1 "USER user 0 * :tester")
(0 ":irc.barnet.org 001 tester :Welcome to the barnet IRC Network tester")