Skip site navigation (1) Skip section navigation (2)

Re: Re: [ODBC] RE: [PATCHES] Fix for ODBC close

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, PostgreSQL odbc list <pgsql-odbc(at)postgresql(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Re: [ODBC] RE: [PATCHES] Fix for ODBC close
Date: 2001-02-11 18:19:17
Message-ID: 6348.981915557@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-odbcpgsql-patches
+               SOCK_put_char(self, 'X');
+               SOCK_flush_output(self);
+               if (!shutdown(self->socket, 2)) /* no sends or receives */
                        closesocket(self->socket);

I think you should issue the close() whether the shutdown() succeeds or
not.  Otherwise you have a file descriptor leak.  In fact, given that
you're going to close the socket, the separate shutdown call is a
complete waste of cycles.  Take it out.

> Hiroshi, should I be concerned that a send() that does not send the full
> packet just returns an error and does not retry?  Is libpq() so complex
> because of async connections?

Right, libpq only needs to loop because it runs the socket in nonblock
mode.  SOCK_flush_output looks OK to me.  (SOCK_get_next_byte, on the
other hand, goes wacko on error or close... probably should make it
return a null character instead of random data.)

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-02-11 18:25:46
Subject: Re: ODBC backward versions
Previous:From: Peter EisentrautDate: 2001-02-11 17:42:15
Subject: Re: [INTERFACES] Re: pgAccess fails to launch on HPUX

pgsql-odbc by date

Next:From: Dave PageDate: 2001-02-11 19:17:45
Subject: RE: [ODBC] RE: [PATCHES] Fix for ODBC close
Previous:From: Bruce MomjianDate: 2001-02-11 13:17:13
Subject: Re: [ODBC] RE: [PATCHES] Fix for ODBC close

pgsql-patches by date

Next:From: Dave PageDate: 2001-02-11 19:17:45
Subject: RE: [ODBC] RE: [PATCHES] Fix for ODBC close
Previous:From: Bruce MomjianDate: 2001-02-11 13:17:13
Subject: Re: [ODBC] RE: [PATCHES] Fix for ODBC close

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group