From: Vivek Dasmohapatra <vivek@etla.org>
To: 5650@debbugs.gnu.org
Subject: bug#5650: Proposed fix
Date: Fri, 26 Feb 2010 23:49:50 +0000 (GMT) [thread overview]
Message-ID: <alpine.DEB.2.00.1002262347460.31229@octopus.pepperfish.net> (raw)
In-Reply-To: <87wry1x9k2.wl%richard.lewis@gold.ac.uk>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 36 bytes --]
Does this patch fix things for you?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-diff; name=0001-Make-the-default-erc-connection-method-non-blocking.patch, Size: 2181 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,6 +483,10 @@ 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.
@@ -523,9 +527,8 @@ We will store server variables in the buffer given by BUFFER."
(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
+ (if (eq (process-status process) 'connect)
+ ;; waiting for anon-blocking connect - keep the user informed
(erc-display-message nil nil buffer "Opening connection..\n")
(erc-login)))
@@ -543,7 +546,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-02-26 23:49 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 ` Vivek Dasmohapatra [this message]
2010-03-04 13:58 ` bug#5650: Oops, bad patch Vivek Dasmohapatra
2010-03-08 23:29 ` bug#5650: updated patch Vivek Dasmohapatra
2015-12-27 22:17 ` 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
List information: https://www.gnu.org/software/emacs/
* 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.1002262347460.31229@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).