* `open-network-stream' in `nntp-open-network-stream': strange behaviour
@ 2000-12-30 15:45 Christoph Conrad
2001-01-01 22:11 ` Jake Colman
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Conrad @ 2000-12-30 15:45 UTC (permalink / raw)
Hi!
Linux 2.2.14, i386, Emacs 20.7.1, latest CVS Oort Gnus.
I have the following problem since a few weeks now, a workaround i found
now is at the end of the mail.
When `open-network-stream' failed ONE time for a given host (cause i am
not online, host overloaded etc.), it fails forever in the same emacs
session. If i restart my Emacs, it works again.
This behaviour is ONLY as described when the hostname is a symbolic name
like "News.CIS.DFN.DE". When i always resolve the name to an ip address
before i give it as argument to `open-network-stream', it works again
after having failed.
I know that this isn't a genuine Gnus problem, it might be a problem of
`open-network-stream' or even my network configuration. Maybe you could
give me a hint. With the workaround below it works as expected.
(defun cc-resolve-address( domain )
(save-excursion
(let ((output-buf (generate-new-buffer " *resolve-address*")))
(unwind-protect
(progn
(set-buffer output-buf)
(and (eq (call-process
"/usr/bin/nslookup" nil output-buf nil
"-retries=1" domain)
0)
(> (point-max) 2)
(goto-char (point-max))
(when (re-search-backward (concat "^Name: [ ]*"
domain
"\n"
"Address: [ ]*\\(.*\\)$")
nil t)
(match-string 1))))
;; unwind-protect cleanup
(kill-buffer output-buf)))))
(defun nntp-open-network-stream( buffer )
(let ( (host nntp-address) )
(when (not (string-match "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"
host))
(setq host (cc-resolve-address host)))
(if host
(open-network-stream "nntpd" buffer host nntp-port-number)
;; kill buffer due to a possible bug in nntp-open-connection
(kill-buffer buffer)
(error "nntp-open-network-stream: couldn't resolve %s" nntp-address))))
Best regards,
cu, -cc-
--
=> GNU Emacs Webring @ <http://nav.webring.yahoo.com/hub?ring=emacs> <=
Look Ma, this man can twist his fingers as if they were made of rubber,
isn't that amazing? -- Not really, he's been using emacs for years...!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `open-network-stream' in `nntp-open-network-stream': strange behaviour
2000-12-30 15:45 `open-network-stream' in `nntp-open-network-stream': strange behaviour Christoph Conrad
@ 2001-01-01 22:11 ` Jake Colman
2001-01-01 22:51 ` Christoph Conrad
0 siblings, 1 reply; 3+ messages in thread
From: Jake Colman @ 2001-01-01 22:11 UTC (permalink / raw)
How are you using this fix? Are you replacing gnus source? I see exactly
the same bug when accessing my imap server.
>>>>> "CC" == Christoph Conrad <christoph.conrad@gmx.de> writes:
CC> Hi! Linux 2.2.14, i386, Emacs 20.7.1, latest CVS Oort Gnus.
CC> I have the following problem since a few weeks now, a workaround i
CC> found now is at the end of the mail.
CC> When `open-network-stream' failed ONE time for a given host (cause i
CC> am not online, host overloaded etc.), it fails forever in the same
CC> emacs session. If i restart my Emacs, it works again.
CC> This behaviour is ONLY as described when the hostname is a symbolic
CC> name like "News.CIS.DFN.DE". When i always resolve the name to an ip
CC> address before i give it as argument to `open-network-stream', it
CC> works again after having failed.
CC> I know that this isn't a genuine Gnus problem, it might be a problem
CC> of `open-network-stream' or even my network configuration. Maybe you
CC> could give me a hint. With the workaround below it works as expected.
CC> (defun cc-resolve-address( domain )
CC> (save-excursion
CC> (let ((output-buf (generate-new-buffer " *resolve-address*")))
CC> (unwind-protect
CC> (progn
CC> (set-buffer output-buf) (and (eq (call-process
CC> "/usr/bin/nslookup" nil output-buf nil
CC> "-retries=1" domain)
CC> 0)
CC> (> (point-max) 2) (goto-char (point-max)) (when
CC> (re-search-backward (concat "^Name: [ ]*"
CC> domain "\n"
CC> "Address: [
CC> ]*\\(.*\\)$")
CC> nil t)
CC> (match-string 1))))
CC> ;; unwind-protect cleanup
CC> (kill-buffer output-buf)))))
CC> (defun nntp-open-network-stream( buffer )
CC> (let ( (host nntp-address) )
CC> (when (not (string-match "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"
CC> host))
CC> (setq host (cc-resolve-address host)))
CC> (if host
CC> (open-network-stream "nntpd" buffer host nntp-port-number)
CC> ;; kill buffer due to a possible bug in nntp-open-connection
CC> (kill-buffer buffer) (error "nntp-open-network-stream: couldn't
CC> resolve %s" nntp-address))))
CC> Best regards, cu, -cc- -- => GNU Emacs Webring @
CC> <http://nav.webring.yahoo.com/hub?ring=emacs> <= Look Ma, this man
CC> can twist his fingers as if they were made of rubber, isn't that
CC> amazing? -- Not really, he's been using emacs for years...!
--
Jake Colman
Principia Partners LLC Phone: (201) 946-0300
Harborside Financial Center Fax: (201) 946-0320
902 Plaza II Beeper: (800) 928-4640
Jersey City, NJ 07311 E-mail: colman@ppllc.com
E-mail: jcolman@jnc.com
web: http://www.ppllc.com
microsoft: "where do you want to go today?"
linux: "where do you want to go tomorrow?"
BSD: "are you guys coming, or what?"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `open-network-stream' in `nntp-open-network-stream': strange behaviour
2001-01-01 22:11 ` Jake Colman
@ 2001-01-01 22:51 ` Christoph Conrad
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Conrad @ 2001-01-01 22:51 UTC (permalink / raw)
Cc: colman
Hi Jake,
you wrote:
> How are you using this fix? Are you replacing gnus source? I see
> exactly the same bug when accessing my imap server.
I included the two pieces of code into .emacs.gnus.el.
`nntp-open-network-stream' replaces the (simple) original definition
from "nntp.el":
;; original
(defun nntp-open-network-stream (buffer)
(open-network-stream "nntpd" buffer nntp-address nntp-port-number))
I see in your headers:
User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Channel Islands)
If you don't mind about a lot of possibly open " *nntpd" buffers (was
fixed a few days ago in the CVS gnus; you don't see the buffers), you
can also use `cc-resolve-address' with
(defadvice open-network-stream
( before nntp-open-network-stream-resolve act )
(when (not (string-match "[0-9.]+" (ad-get-arg 2)))
(ad-set-arg 2 (cc-resolve-address nntp-address))))
instead of replacing `nntp-open-network-stream'. This a little bit
cleaner. Please let me know if it solves your problem.
Best regards,
cu, -cc-
--
=> GNU Emacs Webring @ <http://www.gnusoftware.com/WebRing/> <=
Look Ma, this man can twist his fingers as if they were made of rubber,
isn't that amazing? -- Not really, he's been using emacs for years...!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-01-01 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-30 15:45 `open-network-stream' in `nntp-open-network-stream': strange behaviour Christoph Conrad
2001-01-01 22:11 ` Jake Colman
2001-01-01 22:51 ` Christoph Conrad
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 NNTP newsgroup(s).