I have a bit of time before the Orcs In Business Suits
come to chain me to the mine cart and start me digging
coal today:-)
Some of the list readers will be aware that there was a
problem with some printers under the following circumstances:
a) Big job sent
b) Warming up
c) Out of Paper
d) All of the above
In releases before ifhp-3.3.20 or abouts there was no problem, but
suddenly there was a problem with 'connections being dropped' and
multiple jobs sent. The cause of this was an effort to add support
for bidirectional parallel ports to ifhp (and LPRng).
The direct cause of this was the fact that the two routines
for writing to an output device,
m = Write_fd_len_timeout( .... )
m = Read_status_timeout( ... )
would return -1 if there was an output error, EOF, OR
a TIMEOUT.
Also, there is a problem where some printers "lose input" during
initialization or when jobs go 'wrong' or just plain lose their
cookies when a bad job file is sent. To assist with this problem,
the ifhp code valiantly tries to clean up the mess by sending a
set of commands that should, hopefully, reset the printer to a
known state and then do the desired function. The commands are:
SYNC - wake up and tell me you are there
PAGECOUNT - tell me what your pagecounter reads
EOJ + WAITEND - end of job, and could you tell me
when you are done, please?
Unfortunately, there are some printers that you need to send these
commands to several times to get a response... so we have a set
of 'interval' options that specify how long to wait before resending:
sync_interval = 20 secs
pagecount_interval = 20 secs
waitend_interval = 600 secs
OK, so what happened?
In the Write_fd_len_timeout() and Read_status_timeout() code I was
detecting the timeout condition all right, but I was returning the
same error code (-1) that I would for a 'bad read/write'. I have
modified the code to return -2 now, and now I check to see if I
get -2, and if I do, I drop into the 'handle elapsed timeout'
code. Actually, what I really do is break from a loop if the
return code is -1, and 'continue' a loop otherwise, as there is
code already there to check to see if I have a timeout.
Now most of the readers of this list would suspect that there
is something else lurking in the background here.
The answer is simple: TCP/IP send buffers.
When you turn some printers into 'offline' mode, they suddenly
go deaf and dumb: no status and refuse to accept commands.
So if you are trying to SYNC, PAGECOUNT, or WAITEND them
(Isn't English wonderful? Verb your noun!) then you will periodically
send little strings to them, the TCP/IP buffers fill up, and
you suddenly find that you are blocked.
This is solved for a network connection, which does a 'select'
and then a 'nonblocking' write (you would not believe the time
it took to find this magic portable combination), which will
not try to put output to the device. But it WILL loose some.
But do not worry... remember the stuff about 'printers losing
their marbles' at the start? The strings sent are carefully
crafted (I hope) to handle this and when the printer is back
on line all will be good.
The really annoying problem are parallel port printers.
When you turn these off line they stop taking input, all
right. But most of the parallel port drivers are broken,
or at least badly bent, and when a signal (SIGALARM)
arrives to terminate the read, will randomly lose a character.
Sigh... So you can read the status (Out of Paper), put paper
in, and then watch as your carefully crafted PostScript raster
image job goes by by... Hopefully without spewing 100s of pages
of junk.
Patrick Powell Astart Technologies,
[EMAIL PROTECTED] 9475 Chesapeake Drive, Suite D,
Network and System San Diego, CA 92123
Consulting 858-874-6543 FAX 858-279-8424
LPRng - Print Spooler (http://www.astart.com)
-----------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------