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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-odbc pgsql-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

Browse pgsql-hackers by date

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

Browse pgsql-odbc by date

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

Browse pgsql-patches by date

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