🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: demon.ip.developers
Article #615

Re: TextWin: why doesn't ftp '#' show immediately?

#615
From: John Washington
Date: Sun, 02 Mar 1997 00:00
70 lines
3542 bytes
On Fri, 28 Feb 1997 18:48:19 +0000 (GMT), in article
     <857155699snz.7550@grempc.demon.co.uk>
     news-reply.7550@grempc.demon.co.uk "Graham E Kinns" wrote:

GK> I think I've found a reason why it might .. usputs() in sockuser.c - I
GK> think there's a bug if the default ASCII flush char is '\n' and the
..
GK> Not that that's the original problem though (although I think it would
GK> explain (IIRC) what you saw with your HTTP client, John).

Thanks.  Sounds interesting, I'll take a look.  However, I
think I've found the cause of the problem(s).

usputs() (and its callers, such as tprintf(), us(v)printf())
are designed (I think) not to flush, except at the flush
character (if any) (such as \n).

So if you want processes (e.g. the FTP client) to flush at
other points, then at each such point the flush must be
explicitly programmed.  OR...

Some other mechanism needs to do the flushing when it's
deemed appropriate.  In ka9q, only one display is visible at
any time.  There is a timer daemon, and it does this quite
frequently (many times per second), flushing the current
session.  In the TextWin version of the code, only the
current session is flushed, but other windows may be
visible.  Hence the different behaviour of code such as the
FTP client, with hashes showing if the window is the current
session but not otherwise.

Clearly there is more than one way of improving the present
code.  One might add to timer.c specific code for TextWin,
flushing all windows at intervals.  I'm reluctant to do
that, I don't know the performance implications.

I intend instead adding a few specific flushes.  Indeed,
with httpcli.c that was what I already thought I was doing,
using tflush().  However, I'd goofed.  tflush() doesn't do
what I thought it does.  Even though I browsed past its
one line body many times, I still read what I thought it
did, not what it really does.  'Current', not 'Curproc'.

Moral: developers should take LOTS of care when selecting
identifiers.

More important moral: maintainers should keep open minds.

[bangs own head against wall several times, to ventilate]

I'd like to think I'd have seen this problem much quicker
if 'Current' had been called 'Cursess' or 'CurrentSession'
or some such.

usflush(Curproc->output) does what I want.  Phew!

The academic question remains open: what did the author of
tflush() really intend?  The rest of the 't' family all use
Curproc->output.  So is this a typo?  Or is it intended to
flush the current session, in which case I suggest this is
yet another unfortunate choice of name.  Or, indeed,
regardless of the original intent, has the insidious rusting
that software suffers during years of maintenance, now
resulted in the present code having some calls of tflush
where one is intended and other calls where..  Depressing
thought, isn't it?

--
John Washington
Technical Details
Message-ID: <857325606snz@wash.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <856807122snz@wash.demon.co.uk> <857022636snx@warren.demon.co.uk> <857079981snz@wash.demon.co.uk> <857155699snz.7550@grempc.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bb05,e158132d43e5f687
X-Google-Attributes: gid10bb05,public
From: John Washington <john@wash.demon.co.uk>
Subject: Re: TextWin: why doesn't ftp '#' show immediately?
Date: 1997/03/02
Message-ID: <857325606snz@wash.demon.co.uk>
X-Deja-AN: 222575403
X-Mail2News-Path: relay-7.mail.demon.net!relay-5.mail.demon.net!wash.demon.co.uk
References: <856807122snz@wash.demon.co.uk> <857022636snx@warren.demon.co.uk> <857079981snz@wash.demon.co.uk> <857155699snz.7550@grempc.demon.co.uk>
X-Mail2News-User: john@wash.demon.co.uk
Newsgroups: demon.ip.developers