mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Use smarter default for erc-server-reconnect-function
* doc/misc/erc.texi (Sample Configuration): Remove customization in `use-package' declaration for `erc-server-reconnect-function' as well as related language in the customization walk-through. Do this because the new default incorporates `erc-server-delayed-check-reconnect' behavior for compatible connect functions. * etc/ERC-NEWS: Announce new default for `erc-server-reconnect-function'. * lisp/erc/erc-backend.el (erc-server-reconnect-function): Change default to `erc-server-prefer-check-reconnect'. (erc-server-delayed-check-reconnect): Use `process-send-string' instead of `send-string'. (erc--server-delayed-check-connectors): New variable. (erc-server-prefer-check-reconnect): New function. * test/lisp/erc/erc-scenarios-base-auto-recon.el (erc-scenarios-base-auto-recon-unavailable) (erc-scenarios-base-auto-recon-no-proto): Remove unnecessary `erc-server-reconnect-function' binding because the new default incorporates the behavior being tested for. * test/lisp/erc/erc-scenarios-base-buffer-display.el (erc-scenarios-base-buffer-display--reconnect-common): * test/lisp/erc/erc-scenarios-base-compat-rename-bouncer.el (erc-scenarios-common--base-compat-no-rename-bouncer): * test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-base.el (erc-scenarios-base-netid-bouncer--recon-base): * test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-both.el (erc-scenarios-base-netid-bouncer--recon-both): * test/lisp/erc/erc-scenarios-base-netid-bouncer-recon-id.el (erc-scenarios-base-netid-bouncer--reconnect-id-foo) (erc-scenarios-base-netid-bouncer--reconnect-id-bar): * test/lisp/erc/erc-scenarios-base-reconnect.el (erc-scenarios-base-reconnect-timer) (erc-scenarios-base-cancel-reconnect): * test/lisp/erc/erc-scenarios-services-misc.el (erc-scenarios-services-misc--reconnect-retry-nick): * test/lisp/erc/erc-scenarios-stamp.el (erc-scenarios-stamp--date-mode/reconnect): Explicitly bind `erc-server-reconnect-function' to `erc-server-delayed-reconnect', the former default, which does not do any probing. (Bug#62044)
This commit is contained in:
parent
e9591fae5e
commit
1c960bda91
12 changed files with 55 additions and 35 deletions
|
|
@ -429,15 +429,16 @@ this value to 120 or greater and/or exploring the option
|
|||
means of handling this situation on some servers."
|
||||
:type 'number)
|
||||
|
||||
(defcustom erc-server-reconnect-function 'erc-server-delayed-reconnect
|
||||
(defcustom erc-server-reconnect-function 'erc-server-prefer-check-reconnect
|
||||
"Function called by the reconnect timer to create a new connection.
|
||||
Called with a server buffer as its only argument. Potential uses
|
||||
include exponential backoff and probing for connectivity prior to
|
||||
dialing. Use `erc-schedule-reconnect' to instead try again later
|
||||
and optionally alter the attempts tally."
|
||||
:package-version '(ERC . "5.5")
|
||||
:package-version '(ERC . "5.6.1")
|
||||
:type '(choice (function-item erc-server-delayed-reconnect)
|
||||
(function-item erc-server-delayed-check-reconnect)
|
||||
(function-item erc-server-prefer-check-reconnect)
|
||||
function))
|
||||
|
||||
(defcustom erc-split-line-length 440
|
||||
|
|
@ -879,7 +880,7 @@ Expect BUFFER to be the server buffer for the current connection."
|
|||
(sentinel (lambda (proc event)
|
||||
(pcase event
|
||||
("open\n"
|
||||
(run-at-time nil nil #'send-string proc
|
||||
(run-at-time nil nil #'process-send-string proc
|
||||
(format "PING %d\r\n"
|
||||
(time-convert nil 'integer))))
|
||||
((or "connection broken by remote peer\n"
|
||||
|
|
@ -901,6 +902,19 @@ Expect BUFFER to be the server buffer for the current connection."
|
|||
(set-process-sentinel proc sentinel))
|
||||
(file-error (funcall reschedule nil)))))))
|
||||
|
||||
(defvar erc--server-delayed-check-connectors
|
||||
'(erc-open-tls-stream erc-open-network-stream)
|
||||
"Functions compatible with `erc-server-delayed-check-reconnect'.")
|
||||
|
||||
(defun erc-server-prefer-check-reconnect (buffer)
|
||||
"Defer to another reconnector based on BUFFER's `erc-session-connector'.
|
||||
Prefer `erc-server-delayed-check-reconnect' if the connector is known to
|
||||
be \"check-aware\". Otherwise, use `erc-server-delayed-reconnect'."
|
||||
(if (memq (buffer-local-value 'erc-session-connector buffer)
|
||||
erc--server-delayed-check-connectors)
|
||||
(erc-server-delayed-check-reconnect buffer)
|
||||
(erc-server-delayed-reconnect buffer)))
|
||||
|
||||
(defun erc-server-filter-function (process string)
|
||||
"The process filter for the ERC server."
|
||||
(with-current-buffer (process-buffer process)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue