mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Include the first valid listen address in pg_ctl to improve server start
"wait" detection and add postmaster start time to help determine if the postmaster is actually using the specified data directory.
This commit is contained in:
@ -483,7 +483,8 @@ PostmasterMain(int argc, char *argv[])
|
||||
int status;
|
||||
char *userDoption = NULL;
|
||||
int i;
|
||||
|
||||
bool connection_line_output = false;
|
||||
|
||||
MyProcPid = PostmasterPid = getpid();
|
||||
|
||||
MyStartTime = time(NULL);
|
||||
@ -860,10 +861,22 @@ PostmasterMain(int argc, char *argv[])
|
||||
UnixSocketDir,
|
||||
ListenSocket, MAXLISTEN);
|
||||
else
|
||||
{
|
||||
status = StreamServerPort(AF_UNSPEC, curhost,
|
||||
(unsigned short) PostPortNumber,
|
||||
UnixSocketDir,
|
||||
ListenSocket, MAXLISTEN);
|
||||
/* must supply a valid listen_address for PQping() */
|
||||
if (!connection_line_output)
|
||||
{
|
||||
char line[MAXPGPATH + 2];
|
||||
|
||||
sprintf(line, "%s\n", curhost);
|
||||
AddToLockFile(LOCK_FILE_LINES - 1, line);
|
||||
connection_line_output = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (status == STATUS_OK)
|
||||
success++;
|
||||
else
|
||||
@ -880,6 +893,10 @@ PostmasterMain(int argc, char *argv[])
|
||||
pfree(rawstring);
|
||||
}
|
||||
|
||||
/* Supply an empty listen_address line for PQping() */
|
||||
if (!connection_line_output)
|
||||
AddToLockFile(LOCK_FILE_LINES - 1, "\n");
|
||||
|
||||
#ifdef USE_BONJOUR
|
||||
/* Register for Bonjour only if we opened TCP socket(s) */
|
||||
if (enable_bonjour && ListenSocket[0] != PGINVALID_SOCKET)
|
||||
|
Reference in New Issue
Block a user