🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #703

Re: Compatibility problem with GNUS and 1.5.10 NNTP

#703
From: Craig Leres
Date: Sat, 22 Sep 1990 04:17
40 lines
2532 bytes
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
Technical Details
Message-ID: <7152@dog.ee.lbl.gov>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!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
References: <SDK.90Sep14103308@shadow.twinsun.com> <PCG.90Sep18174330@odin.cs.aber.ac.uk>

Show Full Headers
Complete Article Headers
Message-ID: <7152@dog.ee.lbl.gov>
Subject: Re: Compatibility problem with GNUS and 1.5.10 NNTP
Date: Sat, 22 Sep 1990 04:17:06 +0000
From: leres@ace.ee.lbl.gov (Craig Leres)
References: <SDK.90Sep14103308@shadow.twinsun.com> <PCG.90Sep18174330@odin.cs.aber.ac.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!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
Newsgroups: news.software.nntp,gnu.emacs.gnus
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