[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev timeouts
From: |
Klaus Weide |
Subject: |
Re: lynx-dev timeouts |
Date: |
Sun, 27 Feb 2000 20:27:51 -0600 (CST) |
On Thu, 27 Jan 2000, Vlad Harchev wrote:
> On Thu, 27 Jan 100, T.E.Dickey wrote:
> > > When trying to connect to a web site which may be locked up, lynx will
> > > sit
> > > there. Is there a timeout parameter I can set to, say, 10 sec?
> >
> > The usual approach is to compile with nsl-fork, and press 'z' when you get
> > bored.
>
> I'm thinking about doing a patch that will add new lynx.cfg and commandline
> option named "connect_timeout", that will specify the number of seconds to
> wait before timing out (it will be multiplied by 10 to get the max number of
> iterations with 'select' to perform, see function HTDoConnect). I looked at
> the code and seems it's clear how to do it. This functionality won't be
> available for DOS (look at the code for the answer). Are there any additional
> thoughts or objections?
Lynx will notice when the connect() call times out. Use operating
system's (or TCP/IP stack's) way of changing that timeout, and it can
apply to all applications (that open a TCP connection) instead of just
one.
> Seems this will be useful for guys that (ab)use lynx as downloader.
If lynx -download is invoked interactively, they can still use ^C.
If lynx -download is invoked non-interactively, it should be possible
to invoke a timeout in shell language. Not for the connect(), but for
the whole retrieval.
Ok, let's try:
---- snip ---
#! /bin/sh
LYNX="./src/lynx" # change this, e.g. to "lynx"
if [ $# -lt 2 ]; then
echo "tolynx - invoke lynx with timeout." >&2
echo "Usage: $0 TIMEOUT LYNXOPTIONS URL" >&2
echo " LYNXOPTIONS should include -dump." >&2
exit 1
fi
TIMEOUT=$1
shift
$LYNX "$@" &
CHILDPID=$!
sleep $TIMEOUT
kill -0 $CHILDPID 2>/dev/null && kill $CHILDPID
exit 0
--- snip ---
Tested with bash, ash, pdksh.
Tweak as desired to make it smarter, using a loop so that it
can finish immediately when the lynx process is done etc.
(see also shells' man pages for the 'wait' builtin).
Klaus
- Re: lynx-dev timeouts,
Klaus Weide <=