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 16:06:56 -0400



Let's hold off for now on moving tds_free_socket. I want to do some
cleanup in tds_connect() this cycle (specifically wrt config) anyway, so
we may end up going that way, but let's just leave it until we know what
the final version is going to look like.


Brian

> OK, I'll add and use tds_close_socket().
>
> I'm still hesitant about moving tds_free_socket() outside. There are 8
> calls right now, but moving it outside will create one for every caller to
> tds_connect(), scattered all over the tree (and outside it in user code).
> It seems less clean to me, but if you feel really strongly about this then
> I'll go ahead with it.
>
> Cheers,
> --nick
>
> -----Original Message-----
> From: bounce-freetds-145195 AT franklin.oit.unc.edu
> [mailto:bounce-freetds-145195 AT franklin.oit.unc.edu]
> Sent: Thursday, September 12, 2002 3:43 PM
> To: TDS Development Group
> Subject: [freetds] Re: WARNING: Changing tds_connect() API
>
>
> > 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