Gnus development mailing list
 help / color / mirror / Atom feed
* `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

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).