[freetds] new network timeout code

James K. Lowden jklowden at freetds.org
Sun Jan 7 01:32:35 EST 2007


James K. Lowden wrote:
> net.c::tds_select().  
> 
> It's not called by anything yet, so it can't do any harm.  

No longer.  net.c has been redone in terms of tds_select.  Cancel messages
are now subject to the same timeouts as queries.  tds_goodwrite looks a
lot like tds_goodread.  Timeout conditions invoke the client library's
error handler.  

All I know for sure is that all but one unit test passed for ct-lib and
db-lib.  ct-lib's "connect_fail" test failed.  I'm not surprised, because
I didn't modify the ct-lib error handling yet.  

We have tests that cancel queries, but I don't think we have anything that
specifically tests timeout handling.  So I think tds_select() works when
everything's OK.  I'm not yet convinced it works with something goes
wrong.  

I didn't compile the ODBC driver.  I'm not set up for it at the moment. 
Do we have an ODBC timeout unit test?   

I don't have a way to test tds7_get_instance_port(), either.  I don't
think it should call tdserror because TDSETIME isn't appropriate and
neither is anything else.  It's not subject to a login timeout or a query
timeout.  Probably the code should (and does) silently try a few times and
return failure if it doesn't get an answer.  Ultimately that becomes a
"could not connect" message.  

I'll look at ct-lib next, to fix up its error-handler interface to libtds.
 Then I'll work on a unit test or two.  I'm hoping to have that done in a
few days.  Then I hope folks will start to use the new snapshots and
provide feedback.  Patches welcome too!  

Many thanks to Frediano and Peter Deacon for their advice.  

--jkl



More information about the FreeTDS mailing list