Xref: utzoo news.software.nntp:831 gnu.emacs.gnus:857 Path: utzoo!utgpu!news-server.csri.toronto.edu!math.lsa.umich.edu!zaphod.mps.ohio-state.edu!usc!ucsd!dog.ee.lbl.gov!ace.ee.lbl.gov!leres From: leres@ace.ee.lbl.gov (Craig Leres) Newsgroups: news.software.nntp,gnu.emacs.gnus Subject: Re: Compatibility problem with GNUS and 1.5.10 NNTP Message-ID: <7152@dog.ee.lbl.gov> Date: 22 Sep 90 04:17:06 GMT References: Sender: usenet@dog.ee.lbl.gov Reply-To: leres@helios.ee.lbl.gov (ucbvax!leres for uucp weenies) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 39 X-Local-Date: Fri, 21 Sep 90 21:17:06 PDT The TIMEOUT code in nntpd used to use ALRM. But the ALONE code also uses ALRM so you couldn't use TIMEOUT and ALONE. Since I wanted to do this, I rewrote serve() to use select() and submitted the new code to Stan. Another reason for the rewrite is that there are other things I want to run off a timer. The version of nntpd I'm currently running has the following timers: - The standard idle timer; close the connection and exit after TIMEOUT seconds of idle time. The reason I do this is to release resources that are not in use. - A cnews batch check timer; launch a partial batch file after BATCHCHECK seconds of idle time. This works really well when you're being fed by a nntplink site. - A /etc/nologin check; look for /etc/nologin every LOGINCHECK seconds and shutdown the connection if its found. This at least gives news readers the option of gracefully handling a shutdown of the news server. These timers are run from a generic interface. It's easy to add more and there aren't any restrictions on which combinations you can use. Anyway, back to the problem; if fgets() reads two lines from the remote side, fgets() returns the first line, buffers the second one and we deadlock at the next call to select(). The solution I like the best (and the one I'm currently testing) is to look and see if there are characters in the stdio buffer: #define BUFFERED_DATA(f) ((f)->_cnt > 0) This probably isn't 100% portable but I believe that it'll work on most systems that have select(). And I'm sure we can come up with something equivalent for those other systems. Craig