Function: rcirc-reconnect

rcirc-reconnect is a byte-compiled function defined in rcirc.el.gz.

Signature

(rcirc-reconnect PROCESS &optional QUIET)

Documentation

Attempt to reconnect connection to PROCESS.

If QUIET is non-nil, no not emit a message.

Source Code

;; Defined in /usr/src/emacs/lisp/net/rcirc.el.gz
(defun rcirc-reconnect (process &optional quiet)
  "Attempt to reconnect connection to PROCESS.
If QUIET is non-nil, no not emit a message."
  (with-rcirc-process-buffer process
    (catch 'exit
      (if (rcirc--connection-open-p process)
          (throw 'exit (or quiet (message "Server process is alive")))
        (delete-process process))
      (setq rcirc-user-authenticated nil)
      (let ((conn-info rcirc-connection-info))
        (setf (nth 5 conn-info)
              (cl-remove-if-not #'rcirc-channel-p
                                (mapcar #'car rcirc-buffer-alist)))
        (dolist (buffer (mapcar #'cdr rcirc-buffer-alist))
          (when (buffer-live-p buffer)
            (with-current-buffer buffer
              (setq mode-line-process ":connecting"))))
        (let ((nprocess (apply #'rcirc-connect conn-info)))
          (when (and (< rcirc-failed-attempts rcirc-reconnect-attempts)
                     (eq (process-status nprocess) 'failed))
            (setq rcirc-failed-attempts (1+ rcirc-failed-attempts))
            (rcirc-print nprocess "*rcirc*" "ERROR" nil
                         (format "Failed to reconnect (%d/%d)..."
                                 rcirc-failed-attempts
                                 rcirc-reconnect-attempts))
            (setq rcirc-reconnection-timer
                  (run-at-time rcirc-reconnect-delay nil
                               #'rcirc-reconnect process t))))))))