Re: How to cancel ct_results ?

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
[email protected] wrote:
> Cytowanie "James K. Lowden" <[email protected]>:
> > Timeout logic is tricky, and no one has done much
> > with the ct-lib code since I re-wrote the libtds layer to correctly
> > handle timeouts (for the first time) in db-lib.  What ct-lib needs is
> > someone with interest and knowledge to apply himself to the problem.
> 
> After some debugging, I've found that the problem comes from  
> gnutls_record_recv.
> There are few solutions:
> 1. Change the socket to non-blocking, but this probably need some  
> changes also in other places where this socket is used.
> 2. Add select with timeout before socket read/write.
> 3. Send some signal or close socket from parallel thread after timeout  
> (I'm not sure if it will help).

Hi Jarek, 

To support db-lib in particular you need a non-blocking socket.  That's
what the normal (non-TLS) logic uses.  Look at tds_goodread() and
tds_select().  There's logic for timeouts and for calling a user-defined
function while waiting.  

It seems to me that goodread() is no help: gnutls_record_recv() should be
called inside tds_goodread() instead, perhaps by altering the READSOCKET
macro.  It might be that easy.  

Regards, 

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.