From: Vivek Dasmohapatra <vivek@etla.org>
To: 5650@debbugs.gnu.org
Subject: bug#5650: updated patch
Date: Mon, 8 Mar 2010 23:29:35 +0000 (GMT) [thread overview]
Message-ID: <alpine.DEB.2.00.1003082327430.32595@octopus.pepperfish.net> (raw)
In-Reply-To: <87wry1x9k2.wl%richard.lewis@gold.ac.uk>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 108 bytes --]
Updated patch, currently in use on my machine, byte compiles cleanly this
time and appears to as expected.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-diff; name=0001-Make-an-async-connection-in-attempt-by-default-in-er.patch, Size: 5431 bytes --]
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -362,7 +362,7 @@ alist."
:type '(repeat (cons (string :tag "Target")
coding-system)))
-(defcustom erc-server-connect-function 'open-network-stream
+(defcustom erc-server-connect-function 'erc-open-network-stream
"Function used to initiate a connection.
It should take same arguments as `open-network-stream' does."
:group 'erc-server
@@ -483,51 +483,53 @@ The current buffer is given by BUFFER."
(memq (process-status erc-server-process) '(run open))))
;;;; Connecting to a server
+(defun erc-open-network-stream (name buffer host service)
+ "As `open-network-stream', but does non-blocking IO"
+ (make-network-process :name name :buffer buffer
+ :host host :service service :nowait t))
(defun erc-server-connect (server port buffer)
"Perform the connection and login using the specified SERVER and PORT.
We will store server variables in the buffer given by BUFFER."
- (let ((msg (erc-format-message 'connect ?S server ?p port)))
+ (let ((msg (erc-format-message 'connect ?S server ?p port)) process)
(message "%s" msg)
- (let ((process (funcall erc-server-connect-function
- (format "erc-%s-%s" server port)
- nil server port)))
- (unless (processp process)
- (error "Connection attempt failed"))
+ (setq process (funcall erc-server-connect-function
+ (format "erc-%s-%s" server port) nil server port))
+ (unless (processp process)
+ (error "Connection attempt failed"))
+ ;; Misc server variables
+ (with-current-buffer buffer
+ (setq erc-server-process process)
+ (setq erc-server-quitting nil)
+ (setq erc-server-reconnecting nil)
+ (setq erc-server-timed-out nil)
+ (setq erc-server-banned nil)
+ (setq erc-server-error-occurred nil)
+ (let ((time (erc-current-time)))
+ (setq erc-server-last-sent-time time)
+ (setq erc-server-last-ping-time time)
+ (setq erc-server-last-received-time time))
+ (setq erc-server-lines-sent 0)
+ ;; last peers (sender and receiver)
+ (setq erc-server-last-peers '(nil . nil)))
+ ;; we do our own encoding and decoding
+ (when (fboundp 'set-process-coding-system)
+ (set-process-coding-system process 'raw-text))
+ ;; process handlers
+ (set-process-sentinel process 'erc-process-sentinel)
+ (set-process-filter process 'erc-server-filter-function)
+ (set-process-buffer process buffer)
+ (erc-log "\n\n\n********************************************\n")
+ (message "%s" (erc-format-message
+ 'login ?n
+ (with-current-buffer buffer (erc-current-nick))))
+ ;; wait with script loading until we receive a confirmation (first
+ ;; MOTD line)
+ (if (eq (process-status process) 'connect)
+ ;; waiting for a non-blocking connect - keep the user informed
+ (erc-display-message nil nil buffer "Opening connection..\n")
(message "%s...done" msg)
- ;; Misc server variables
- (with-current-buffer buffer
- (setq erc-server-process process)
- (setq erc-server-quitting nil)
- (setq erc-server-reconnecting nil)
- (setq erc-server-timed-out nil)
- (setq erc-server-banned nil)
- (setq erc-server-error-occurred nil)
- (let ((time (erc-current-time)))
- (setq erc-server-last-sent-time time)
- (setq erc-server-last-ping-time time)
- (setq erc-server-last-received-time time))
- (setq erc-server-lines-sent 0)
- ;; last peers (sender and receiver)
- (setq erc-server-last-peers '(nil . nil)))
- ;; we do our own encoding and decoding
- (when (fboundp 'set-process-coding-system)
- (set-process-coding-system process 'raw-text))
- ;; process handlers
- (set-process-sentinel process 'erc-process-sentinel)
- (set-process-filter process 'erc-server-filter-function)
- (set-process-buffer process buffer)))
- (erc-log "\n\n\n********************************************\n")
- (message "%s" (erc-format-message
- 'login ?n
- (with-current-buffer buffer (erc-current-nick))))
- ;; wait with script loading until we receive a confirmation (first
- ;; MOTD line)
- (if (eq erc-server-connect-function 'open-network-stream-nowait)
- ;; it's a bit unclear otherwise that it's attempting to establish a
- ;; connection
- (erc-display-message nil nil buffer "Opening connection..\n")
- (erc-login)))
+ (erc-login)) ))
(defun erc-server-reconnect ()
"Reestablish the current IRC connection.
@@ -543,7 +545,7 @@ Make sure you are in an ERC buffer when running this."
(setq erc-server-last-sent-time 0)
(setq erc-server-lines-sent 0)
(let ((erc-server-connect-function (or erc-session-connector
- 'open-network-stream)))
+ 'erc-open-network-stream)))
(erc-open erc-session-server erc-session-port erc-server-current-nick
erc-session-user-full-name t erc-session-password)))))
next prev parent reply other threads:[~2010-03-08 23:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 21:57 bug#5650: 23.1; ERC causes Emacs to hang on network dropouts Richard Lewis
2010-02-26 23:49 ` bug#5650: Proposed fix Vivek Dasmohapatra
2010-03-04 13:58 ` bug#5650: Oops, bad patch Vivek Dasmohapatra
2010-03-08 23:29 ` Vivek Dasmohapatra [this message]
2015-12-27 22:17 ` bug#5650: updated patch Lars Ingebrigtsen
2010-04-25 20:39 ` bug#5650: Issue with the patch Thomas Riccardi
2015-12-27 22:17 ` Lars Ingebrigtsen
2010-08-14 23:05 ` bug#5650: 23.1; ERC causes Emacs to hang on network dropouts Chong Yidong
2013-02-06 0:06 ` bug#5650: Status Michael McCracken
[not found] ` <87fwyg7q23.fsf@stupidchicken.com>
2015-12-27 22:16 ` bug#5650: 23.1; ERC causes Emacs to hang on network dropouts Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.00.1003082327430.32595@octopus.pepperfish.net \
--to=vivek@etla.org \
--cc=5650@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.