| From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
|---|---|
| To: | Ryan Kelly <rpkelly22(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: [PATCH] Allow breaking out of hung connection attempts |
| Date: | 2012-01-09 08:35:50 |
| Message-ID: | 4F0AA6E6.10608@enterprisedb.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 08.01.2012 22:18, Ryan Kelly wrote:
> @@ -1570,7 +1570,13 @@ do_connect(char *dbname, char *user, char *host, char *port)
> keywords[7] = NULL;
> values[7] = NULL;
>
> - n_conn = PQconnectdbParams(keywords, values, true);
> + if (sigsetjmp(sigint_interrupt_jmp, 1) != 0) {
> + /* got here with longjmp */
> + } else {
> + sigint_interrupt_enabled = true;
> + n_conn = PQconnectdbParams(keywords, values, true);
> + sigint_interrupt_enabled = false;
> + }
>
> free(keywords);
> free(values);
That assumes that it's safe to longjmp out of PQconnectdbParams at any
instant. It's not. I think you'd need to use the asynchronous connection
functions PQconnectStartParams() and PQconnectPoll(), and select().
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Magnus Hagander | 2012-01-09 10:09:35 | Re: streaming header too small |
| Previous Message | Jaime Casanova | 2012-01-09 06:34:11 | streaming header too small |