Guard against any issues on StartConnectionEstablishment

preventConflictingFlags
Onder Kalaci 2020-04-01 15:12:10 +02:00
parent 5083f058f8
commit 217b6520cb
1 changed files with 14 additions and 1 deletions

View File

@ -355,7 +355,20 @@ StartNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port,
* Either no caching desired, or no pre-established, non-claimed, * Either no caching desired, or no pre-established, non-claimed,
* connection present. Initiate connection establishment. * connection present. Initiate connection establishment.
*/ */
connection = StartConnectionEstablishment(&key); PG_TRY();
{
connection = StartConnectionEstablishment(&key);
}
PG_CATCH();
{
/*
* Something went wrong, make sure to decement
* here otherwise we'd leak the increment we have done for this
* connection attempt.
*/
DecrementSharedConnectionCounter(hostname, port);
}
PG_END_TRY();
dlist_push_tail(entry->connections, &connection->connectionNode); dlist_push_tail(entry->connections, &connection->connectionNode);