Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3258484

Browse files
committed
Add tv_sec change for connection timeout suggested by author.
1 parent 2177b6b commit 3258484

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.207 2002/10/11 04:12:14 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.208 2002/10/11 04:41:59 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1078,7 +1078,8 @@ connectDBComplete(PGconn *conn)
10781078
finish_time = time((time_t *) NULL) + remains.tv_sec;
10791079
}
10801080

1081-
while (rp == NULL || remains.tv_sec > 0 || remains.tv_usec > 0)
1081+
while (rp == NULL || remains.tv_sec > 0 ||
1082+
(remains.tv_sec == 0 && remains.tv_usec > 0))
10821083
{
10831084
/*
10841085
* Wait, if necessary. Note that the initial state (just after
@@ -1131,10 +1132,7 @@ connectDBComplete(PGconn *conn)
11311132
return 0;
11321133
}
11331134

1134-
if (finish_time > current_time)
1135-
remains.tv_sec = finish_time - current_time;
1136-
else
1137-
remains.tv_sec = 0;
1135+
remains.tv_sec = finish_time - current_time;
11381136
remains.tv_usec = 0;
11391137
}
11401138
}

0 commit comments

Comments
 (0)