> From [EMAIL PROTECTED] Mon Oct 30 10:32:59 2000
> Date: Mon, 30 Oct 2000 18:05:46 +0100
> From: Bodo Moeller <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: LPRng: 'no response from printer'
>
> On Fri, Oct 27, 2000 at 04:33:03PM -0400, Edwin Lim wrote:
>
> > I think this is similar to the problem that I have seen (and just reported
> > a day ago). [...]
>
> I've spent some time looking at both versions of ifhp.c by now
> (3.3.13, which always appeared to work well, and 3.4.1, which does
> not).

Ummm... but it did not work with bidirectional parallel ports,
which is what caused all this mess.
>
> 3.3.13 had a function Read_write_timemout that would return the number
> of bytes still left to be written, or -1 for an error.
> Do_waitend would adjust its buffer accordingly:
>
>               len = Read_write_timeout( input_fd, &flag,
>                       output_fd, Outbuf, Outlen, timeout );
>               DEBUG3("Do_waitend: write len %d, flag %d", len, flag );
>               if( len < 0 ){
>                       break;
>               } else if( len >= 0 ){
>                       memmove(Outbuf, Outbuf+(Outlen - len), len);
>                       Outlen = len;
>               }
>
> Apparently this is why Do_waitend was patient for more than waitend_interval
> seconds when trying to request status information from the printer:
> It could read something even though writing was stalled, and writing
> would just be retried or continued later.
>
> The new Write_read_timeout function insists on writing all of the
> buffer in one timeout interval (usually 300 seconds), or it will
> report an error -- its return value is either 0 (success) or -1 (error),
> it's no longer possible to report that some data could be read
> but not all data could be written.

Almost.  Actually,  it has some truly HORRIBLE code in to deal with several
parallel/USB devices.  If the device is a network socket,  then it will
try to do a NONBLOCKING write.  Now the semantics for a nonblocking write
is that the driver will try to take as much data as it can,  and returns
the number of bytes written.  A zero or negative value indicates no bytes taken.

Now on several releases of Linux I have observed that this causes the
ifhp system to go into a 'writing frenzy' so I have put a small delay
in the operation when this happens.

All of this stuff was caused by implementations of Parallel Port
drivers that did not implement non-blocking read and writes correctly,
and select() operations correctly.

Sigh...

Patrick

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to