[freetds] cancel and timeout

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Thu Jan 20 11:29:59 EST 2005


Well.. I did a big job on these stuff today... they just works (although
not perfectly).

Cancellation
------------

Added a TDS_READING state, now we have
TDS_DEAD connection broken, no read or send from server
TDS_IDLE client did not send data and we are no waiting data from server
TDS_QUERYING we are sending data to server
TDS_PENDING we are expecting data from server
TDS_READING we are reading data from server
As you can see TDS_READING and TDS_PENDING seems quite similar however
when you are in tds_process_results_tokens or similar state it's
TDS_READING while from outside we are in TDS_PENDING. This it's the key
of cancel fix. If we issue a cancel while another function it's reading
data we just set a in_cancel flag in TDSSOCKET and
tds_process_results_tokens function detect and handle cancellation by
itself. If we are in pending we can process cancel from server
(tds_process_cancel). The key now it's tds_set_state, to fix even thread
problem (like SQLCancel from another thread) a syncronization should
occur).
Asyncronous calls (signals) works as expected. 
TODO:
  better tds_process_cancel
  fix odbc using TDS_INT_CANCEL instead of TDS_INT_CONTINUE and
SQLCancel
  do not take into account in_cancel if we can return a correct result??

Timeout
-------
Now if a timeout (now query_timeout) a query_timeout_func it's called. I
removed chkintr and hndlintr (one function it's sufficient).
query_start_time it's use for global time counting. I don't know if
query timeout on dblib works as expected. Perhaps even SQLFetch or
similar need setting timeout.

... 

freddy77


More information about the FreeTDS mailing list