freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <camber AT ais.org>
- To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
- Subject: Re: Cancel problem
- Date: Wed, 4 Sep 2002 07:08:55 -0400 (EDT)
There should be no need for a TDS_CANCELLING state, since we enter
tds_process_cancel() and don't (well shouldn't maybe) leave until we have
completed the cancel. The real problem is we call tds_get_byte and he
makes only one attempt at reading a packet
if (tds->in_pos >= tds->in_len) {
if (!tds->s || !tds_read_packet(tds))
return (0);
}
return tds->in_buf[tds->in_pos++];
}
is the problem code. A simple fix is:
...
while (tds->s && (tds_read_packet(tds) || tds->in_buf[0] == 0x0f))
...
which is kinda kludgy. A better solution is to modify tds_read_packet to
return -1 instead of 0 on error. Since it is called only two places, both
within read.c and one ignores the return code, it's fairly localized
behaviour.
Brian
On Wed, 4 Sep 2002, ZIGLIO Frediano wrote:
> Ok, understood the problem.
>
> You send cancel
> Server return a cancel only-header packet.
> tds_process_cancel read a byte.
> If only-header packet is received tds_get_byte return a zero.
> tds_process_cancel on received zero act as a done/cancel token (this patch
> is not so good, see diff between version 1.25 and 1.26 in token.c at
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/freetds/freetds/src/tds/token
> .c.diff?r1=1.25&r2=1.26&sortby=date, IMHO should be removed..).
> Replacing the if in tds_get_byte with a while whould resolve partially the
> problem.
>
> Note that while sending cancel server can send another packet...
> I suggest to add a TDS_CANCELLING state, read should discard all packet in
> cancelling and stop reading the only-header cancel packet, then change state
> (TDS_CANCELLED ??) and act in the usually mode.
>
> Also before sending cancel packet we should discard partial packet (just a
> init packet before sending it).
>
> Seem not so difficult but should be tested accurately...
>
> freddy77
>
-
Cancel problem,
ZIGLIO Frediano, 09/04/2002
- <Possible follow-up(s)>
- Re: Cancel problem, Brian Bruns, 09/04/2002
- Re: Cancel problem, Brian Bruns, 09/04/2002
- Re: Cancel problem, Brian Bruns, 09/04/2002
- Re: Cancel problem, ZIGLIO Frediano, 09/04/2002
- Re: Cancel problem, Brian Bruns, 09/04/2002
- Re: Cancel problem, ZIGLIO Frediano, 09/04/2002
- Re: Cancel problem, Brian Bruns, 09/04/2002
- Re: Cancel problem, ZIGLIO Frediano, 09/04/2002
- Re: Cancel problem, Thompson, Bill D (London), 09/04/2002
- Re: Cancel problem, Lowden, James K, 09/04/2002
Archive powered by MHonArc 2.6.24.