Function: erc-server-delayed-check-reconnect
erc-server-delayed-check-reconnect is a byte-compiled function defined
in erc-backend.el.gz.
Signature
(erc-server-delayed-check-reconnect BUFFER)
Documentation
Wait for internet connectivity before trying to reconnect.
Use server BUFFER's cached session info to reestablish the logical
connection at the IRC protocol level. Do this by probing for any
response to a PING, including a hang up, before (possibly) dialing again
and commencing with "connection registration". Make no distinction
between configuration issues and the absence of service in printed
feedback. For example, expect users of proxy-based connectors, like
erc-open-socks-tls-stream, to ensure their setup works before choosing
this function as their reconnector.
Source Code
;; Defined in /usr/src/emacs/lisp/erc/erc-backend.el.gz
;; This probing strategy may appear to hang at various junctures. It's
;; assumed that when *Messages* contains "Waiting for socket ..." or
;; similar, progress will be made eventually.
(defun erc-server-delayed-check-reconnect (buffer)
"Wait for internet connectivity before trying to reconnect.
Use server BUFFER's cached session info to reestablish the logical
connection at the IRC protocol level. Do this by probing for any
response to a PING, including a hang up, before (possibly) dialing again
and commencing with \"connection registration\". Make no distinction
between configuration issues and the absence of service in printed
feedback. For example, expect users of proxy-based connectors, like
`erc-open-socks-tls-stream', to ensure their setup works before choosing
this function as their reconnector."
(when (buffer-live-p buffer)
(with-current-buffer buffer
(setq erc--server-reconnect-timeout
(funcall erc--server-reconnect-timeout-scale-function
(or erc--server-reconnect-timeout
erc-server-reconnect-timeout)))
(condition-case _
(let* ((cert erc-session-client-certificate)
(server (if (string-match erc--server-connect-dumb-ipv6-regexp
erc-session-server)
(match-string 1 erc-session-server)
erc-session-server))
(name (if erc-server-delayed-check-reconnect-reuse-process-p
(format "erc-%s-%s" server erc-session-port)
"*erc-connectivity-check*"))
(proc (apply erc-session-connector name
nil server erc-session-port
(and cert (list :client-certificate cert))))
(status (process-status proc)))
(set-process-buffer proc buffer)
(set-process-filter proc #'ignore)
(if (not (eq status 'connect)) ; :nowait is nil
(erc--recon-probe-sentinel proc (if (eq status 'open)
"open\n"
"failed"))
(run-at-time 1 nil #'erc--recon-probe-check proc
(time-add erc--server-reconnect-timeout-check
(current-time)))
(set-process-sentinel proc #'erc--recon-probe-sentinel)))
;; E.g., "make client process failed" "Connection refused".
(file-error (erc--recon-probe-reschedule nil))
;; C-g during blocking connect, like with the SOCKS connector.
(quit (erc--cancel-auto-reconnect-timer))))))