GNU bug report logs -
#17045
24.3.50; feature request: rcirc-reconnect
Previous Next
Reported by: sds <at> gnu.org
Date: Thu, 20 Mar 2014 02:34:01 UTC
Severity: wishlist
Found in version 24.3.50
Fixed in version 25.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17045 in the body.
You can then email your comments to 17045 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Thu, 20 Mar 2014 02:34:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
sds <at> gnu.org
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 20 Mar 2014 02:34:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
It is not nice to have to do M-x rcirc whenever the connection dies.
Would it be possible to incorporate something similar to
http://www.emacswiki.org/emacs/rcircReconnect
Please?
In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
of 2014-03-18 on sds-MacBook-Pro.local
Windowing system distributor `Apple', version 10.3.1265
Configured using:
`configure --with-ns'
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1265
http://www.childpsy.net/ https://www.facebook.com/TheIslamicThreat
http://camera.org http://americancensorship.org http://ffii.org
Yellow wine is called "white" because it is made out of green grapes.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Tue, 08 Apr 2014 08:45:03 GMT)
Full text and
rfc822 format available.
Message #8 received at 17045 <at> debbugs.gnu.org (full text, mbox):
On 2014-03-20 10:33 +0800, Sam Steingold wrote:
> It is not nice to have to do M-x rcirc whenever the connection dies.
> Would it be possible to incorporate something similar to
> http://www.emacswiki.org/emacs/rcircReconnect
> Please?
>
> In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
> of 2014-03-18 on sds-MacBook-Pro.local
> Windowing system distributor `Apple', version 10.3.1265
> Configured using:
> `configure --with-ns'
Hi Sam,
Would something like this suit your needs? Thanks for testing. - Leo
=== modified file 'lisp/net/rcirc.el'
--- lisp/net/rcirc.el 2014-04-08 03:32:37 +0000
+++ lisp/net/rcirc.el 2014-04-08 08:27:11 +0000
@@ -521,6 +521,7 @@
(defvar rcirc-user-authenticated nil)
(defvar rcirc-user-disconnect nil)
(defvar rcirc-connecting nil)
+(defvar rcirc-connection-info nil)
(defvar rcirc-process nil)
;;;###autoload
@@ -549,22 +550,23 @@
(set-process-sentinel process 'rcirc-sentinel)
(set-process-filter process 'rcirc-filter)
- (set (make-local-variable 'rcirc-process) process)
- (set (make-local-variable 'rcirc-server) server)
- (set (make-local-variable 'rcirc-server-name) server) ; Update when we get 001 response.
- (set (make-local-variable 'rcirc-buffer-alist) nil)
- (set (make-local-variable 'rcirc-nick-table)
- (make-hash-table :test 'equal))
- (set (make-local-variable 'rcirc-nick) nick)
- (set (make-local-variable 'rcirc-process-output) nil)
- (set (make-local-variable 'rcirc-startup-channels) startup-channels)
- (set (make-local-variable 'rcirc-last-server-message-time)
- (current-time))
-
- (set (make-local-variable 'rcirc-timeout-timer) nil)
- (set (make-local-variable 'rcirc-user-disconnect) nil)
- (set (make-local-variable 'rcirc-user-authenticated) nil)
- (set (make-local-variable 'rcirc-connecting) t)
+ (setq-local rcirc-connection-info
+ (list server port nick user-name full-name startup-channels
+ password encryption))
+ (setq-local rcirc-process process)
+ (setq-local rcirc-server server)
+ (setq-local rcirc-server-name server) ; Update when we get 001 response.
+ (setq-local rcirc-buffer-alist nil)
+ (setq-local rcirc-nick-table (make-hash-table :test 'equal))
+ (setq-local rcirc-nick nick)
+ (setq-local rcirc-process-output nil)
+ (setq-local rcirc-startup-channels startup-channels)
+ (setq-local rcirc-last-server-message-time (current-time))
+
+ (setq-local rcirc-timeout-timer nil)
+ (setq-local rcirc-user-disconnect nil)
+ (setq-local rcirc-user-authenticated nil)
+ (setq-local rcirc-connecting t)
(add-hook 'auto-save-hook 'rcirc-log-write)
@@ -782,11 +784,11 @@
(defun rcirc-buffer-process (&optional buffer)
"Return the process associated with channel BUFFER.
With no argument or nil as argument, use the current buffer."
- (or (get-buffer-process (if buffer
- (with-current-buffer buffer
- rcirc-server-buffer)
- rcirc-server-buffer))
- rcirc-process))
+ (let ((buffer (or buffer (if (buffer-live-p rcirc-server-buffer)
+ rcirc-server-buffer
+ (error "Server buffer deleted")))))
+ (or (with-current-buffer buffer rcirc-process)
+ rcirc-process)))
(defun rcirc-server-name (process)
"Return PROCESS server name, given by the 001 response."
@@ -2210,6 +2212,17 @@
reason
rcirc-id-string))))
+(defun-rcirc-command reconnect (_)
+ "Reconnect to current server."
+ (interactive "i")
+ (with-rcirc-server-buffer
+ (unless (or rcirc-connecting (process-live-p process))
+ (let ((conn-info (copy-sequence rcirc-connection-info)))
+ (setf (nth 5 conn-info)
+ (cl-remove-if-not #'rcirc-channel-p
+ (mapcar #'car rcirc-buffer-alist)))
+ (apply #'rcirc-connect conn-info)))))
+
(defun-rcirc-command nick (nick)
"Change nick to NICK."
(interactive "i")
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Tue, 08 Apr 2014 09:34:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 17045 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Leo Liu <sdl.web <at> gmail.com> writes:
> On 2014-03-20 10:33 +0800, Sam Steingold wrote:
>> It is not nice to have to do M-x rcirc whenever the connection dies.
>> Would it be possible to incorporate something similar to
>> http://www.emacswiki.org/emacs/rcircReconnect
>> Please?
>>
>> In GNU Emacs 24.3.50.1 (x86_64-apple-darwin13.1.0, NS apple-appkit-1265.19)
>> of 2014-03-18 on sds-MacBook-Pro.local
>> Windowing system distributor `Apple', version 10.3.1265
>> Configured using:
>> `configure --with-ns'
>
> Hi Sam,
>
> Would something like this suit your needs? Thanks for testing. - Leo
It would be nice if a hook was run with the old and the new process as
arguments.
For example, shoes-off[1] would need it to update the process plist and
its inner structures.
1: https://github.com/nicferrier/shoes-off
--
Daimrod/Greg
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Tue, 08 Apr 2014 11:54:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 17045 <at> debbugs.gnu.org (full text, mbox):
On 2014-04-08 17:33 +0800, Daimrod wrote:
> It would be nice if a hook was run with the old and the new process as
> arguments.
>
> For example, shoes-off[1] would need it to update the process plist and
> its inner structures.
>
> 1: https://github.com/nicferrier/shoes-off
Please give more details about what it does and the requirements to
support it. I probably won't have time to try 3rd party code.
Thanks,
Leo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Tue, 08 Apr 2014 14:04:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 17045 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Leo Liu <sdl.web <at> gmail.com> writes:
> On 2014-04-08 17:33 +0800, Daimrod wrote:
>> It would be nice if a hook was run with the old and the new process as
>> arguments.
>>
>> For example, shoes-off[1] would need it to update the process plist and
>> its inner structures.
>>
>> 1: https://github.com/nicferrier/shoes-off
>
> Please give more details about what it does and the requirements to
> support it. I probably won't have time to try 3rd party code.
Shoes-off is an IRC bouncer built on top of RCIRC. So basically, it uses
RCIRC to connect to IRC servers and listen on a specific port for
clients. When a clients connect, it is as if it was connected to the IRC
servers. To do that, shoes-off "binds" RCIRC processes to a client
connection and it uses process-plist to store this kind of information.
However, when a RCIRC connection is restarted, AFAIK it just means that
a new connection is established. So, from shoes-off's POV, the previous
RCIRC process is dead, hence it can not continue to forward the messages
between the RCIRC connection and the client.
That's why I would like a way to be notified when a RCIRC process is
replaced so that shoes-off can update the connections information. But
to do that, I would probably need more that just a notification, I would
need the old and the new process.
Best,
--
Daimrod/Greg
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Wed, 09 Apr 2014 21:18:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 17045 <at> debbugs.gnu.org (full text, mbox):
> * Daimrod <qnvzebq <at> tznvy.pbz> [2014-04-08 23:03:45 +0900]:
>
> That's why I would like a way to be notified when a RCIRC process is
> replaced so that shoes-off can update the connections information.
would rcirc-reconnect-hook be enough?
> But to do that, I would probably need more that just a notification, I
> would need the old and the new process.
I am afraid the old process is dead and discarded by this time.
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1265
http://www.childpsy.net/ http://palestinefacts.org
http://islamexposedonline.com http://truepeace.org http://dhimmi.com
Murphy's Law was probably named after the wrong guy.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Wed, 09 Apr 2014 21:23:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 17045 <at> debbugs.gnu.org (full text, mbox):
Hi Leo,
> * Leo Liu <fqy.jro <at> tznvy.pbz> [2014-04-08 16:33:18 +0800]:
>
> Would something like this suit your needs? Thanks for testing. - Leo
looks good, except that you might want to avoid mixing functional
changes with cosmetic ones (setq-local & rcirc-buffer-process).
thanks!
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1265
http://www.childpsy.net/ http://honestreporting.com http://palestinefacts.org
http://memri.org https://www.facebook.com/TheIslamicThreat http://truepeace.org
If Microsoft wrote poetry, it would have patented dactyl and anapest.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Thu, 10 Apr 2014 00:49:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 17045 <at> debbugs.gnu.org (full text, mbox):
Sam Steingold <sds <at> gnu.org> writes:
>> * Daimrod <qnvzebq <at> tznvy.pbz> [2014-04-08 23:03:45 +0900]:
>>
>> That's why I would like a way to be notified when a RCIRC process is
>> replaced so that shoes-off can update the connections information.
>
> would rcirc-reconnect-hook be enough?
>
>> But to do that, I would probably need more that just a notification, I
>> would need the old and the new process.
>
> I am afraid the old process is dead and discarded by this time.
Hmm, does the new process use the same buffer or does it create a new
one?
I'm trying to find a way to identify which RCIRC process is replaced.
Simply checking which connection is dead is probably not enough in case
more than one conections dropped at the same time.
--
Daimrod/Greg
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Thu, 10 Apr 2014 04:43:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 17045 <at> debbugs.gnu.org (full text, mbox):
On 2014-04-10 08:47 +0800, Daimrod wrote:
> Hmm, does the new process use the same buffer or does it create a new
> one?
>
> I'm trying to find a way to identify which RCIRC process is replaced.
> Simply checking which connection is dead is probably not enough in case
> more than one conections dropped at the same time.
When users kick off /reconnect it will find the connection info in the
server buffer and fire off rcirc-connect which will reuse the buffer if
I am not mistaken.
Leo
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Thu, 10 Apr 2014 05:08:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 17045 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Leo Liu <sdl.web <at> gmail.com> writes:
> On 2014-04-10 08:47 +0800, Daimrod wrote:
>> Hmm, does the new process use the same buffer or does it create a new
>> one?
>>
>> I'm trying to find a way to identify which RCIRC process is replaced.
>> Simply checking which connection is dead is probably not enough in case
>> more than one conections dropped at the same time.
>
> When users kick off /reconnect it will find the connection info in the
> server buffer and fire off rcirc-connect which will reuse the buffer if
> I am not mistaken.
Ok, then it's doable.
Best,
--
Daimrod/Greg
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Wed, 07 May 2014 17:58:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 17045 <at> debbugs.gnu.org (full text, mbox):
Hi Leo,
> * Leo Liu <fqy.jro <at> tznvy.pbz> [2014-04-08 16:33:18 +0800]:
>
> On 2014-03-20 10:33 +0800, Sam Steingold wrote:
>> It is not nice to have to do M-x rcirc whenever the connection dies.
>> Would it be possible to incorporate something similar to
>> http://www.emacswiki.org/emacs/rcircReconnect
>
> Would something like this suit your needs? Thanks for testing. - Leo
This indeed enables me to auto-reconnect like this:
--8<---------------cut here---------------start------------->8---
(defvar sds-rcirc-sentinel-last (current-time) "last reconnect attempt time")
(defun sds-rcirc-sentinel (process sentinel)
(let* ((now (current-time))
(delay (float-time (time-subtract (current-time)
sds-rcirc-sentinel-last))))
(message "%s sds-rcirc-sentinel: %s %s %s (last: %s, %s ago)"
(format-time-string "%F %R") process
(process-status process) sentinel
(format-time-string "%F %R" sds-rcirc-sentinel-last)
(sds-difftime-to-string delay))
(when (and (string= sentinel "deleted")
(< 60 delay)) ; do not try to reconnect more than once a minute
(setq sds-rcirc-sentinel-last now)
(rcirc-cmd-reconnect nil))))
(add-hook 'rcirc-sentinel-functions 'sds-rcirc-sentinel)
--8<---------------cut here---------------end--------------->8---
However, I would much prefer to enable auto-reconnect by a simple
(custom-set-variables '(rcirc-reconnect-interval 60))
where rcirc-reconnect-interval = 0 means the current behavior (no
auto-reconnect).
Do you mind if I commit something based on the above or would you like
to implement it yourself?
Thanks a lot for your help!
--
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1265
http://www.childpsy.net/ http://think-israel.org http://mideasttruth.com
http://pmw.org.il http://honestreporting.com
There is an exception to every rule, including this one.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#17045
; Package
emacs
.
(Thu, 08 May 2014 02:00:03 GMT)
Full text and
rfc822 format available.
Message #38 received at 17045 <at> debbugs.gnu.org (full text, mbox):
On 2014-05-07 13:57 -0400, Sam Steingold wrote:
> Do you mind if I commit something based on the above?
Not at all. Please make the change and thanks ;)
Leo
bug marked as fixed in version 25.1, send any further explanations to
17045 <at> debbugs.gnu.org and sds <at> gnu.org
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 12 Dec 2017 02:30:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 09 Jan 2018 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.