Re: How to cancel ct_results ?
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hi! Cytowanie "James K. Lowden" <[email protected]>: > Jarek wrote: >> when connection to database >> is lost just before call to ct_results, my application hangs. It looks >> that ct_results doesn't return in such case. > > It might be the case. 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). I'm ready to write this code, but I'd like to know which solution will be the best. I hope this code can be added to future releases of freetds. Best regards Jarek ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.