From 3258484d032c26bf45e00c304e2cb178ff291812 Mon Sep 17 00:00:00 2001 From: Bruce Momjian <bruce@momjian.us> Date: Fri, 11 Oct 2002 04:41:59 +0000 Subject: [PATCH] Add tv_sec change for connection timeout suggested by author. --- src/interfaces/libpq/fe-connect.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 114f23f7974..6f9ba4abddf 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.207 2002/10/11 04:12:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.208 2002/10/11 04:41:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1078,7 +1078,8 @@ connectDBComplete(PGconn *conn) finish_time = time((time_t *) NULL) + remains.tv_sec; } - while (rp == NULL || remains.tv_sec > 0 || remains.tv_usec > 0) + while (rp == NULL || remains.tv_sec > 0 || + (remains.tv_sec == 0 && remains.tv_usec > 0)) { /* * Wait, if necessary. Note that the initial state (just after @@ -1131,10 +1132,7 @@ connectDBComplete(PGconn *conn) return 0; } - if (finish_time > current_time) - remains.tv_sec = finish_time - current_time; - else - remains.tv_sec = 0; + remains.tv_sec = finish_time - current_time; remains.tv_usec = 0; } } -- GitLab