Skip to Content.
Sympa Menu

freetds - Re: WARNING: Changing tds_connect() API

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: WARNING: Changing tds_connect() API
  • Date: Thu, 12 Sep 2002 15:43:21 -0400


> OK, I was forgetting the bit in dbdead() where it checks tds->s. So I
> reworked my changes along the lines you suggested, and I will upload a new
> patch for review.

Sounds good.

> I didn't bother to make a tds_close_socket() function, since it isn't likely
> to be needed anywhere else.

Might be nice for clarity. IIRC, somebody has a disconnect/reconnect
patch floating around somewhere that this might be useful for. If we
provide a clean mechanism now, hopefully it will get used in the future.

> I also didn't move the tds_free_socket() calls out of tds_connect(). I
> don't want to make the caller do any more work than is necessary, so it
> seems fine to leave that as is.

There are 8 calls to tds_free_socket() inside tds_connect, it might be
simpler to move them outside. Not to mention that given:

tds = tds_alloc_socket(context, 512);
/* ...blah blah... */
tds_connect(tds, login);

My socket is magically deallocated when I call tds_connect? Looking at
that code, I'd intuitively think I'm responsible for free'ing.

I'm realizing now that I made the wrong decision when we added the
'parent' argument to tds_connect() the first time around to allow messages
to be generated on unconnected sockets, and should have done this then.
You'll note some commented out calls to tds_set_parent(). C'est la vie!

> Cheers,
> --nick

Cheers,

Brian




Archive powered by MHonArc 2.6.24.

Top of Page