From 4945e4ed4a72c3ff41560ccef722c3d70ae07dbb Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 12 Mar 2024 13:42:38 +0200 Subject: Move initialization of the Port struct to the child process In postmaster, use a more lightweight ClientSocket struct that encapsulates just the socket itself and the remote endpoint's address that you get from accept() call. ClientSocket is passed to the child process, which initializes the bigger Port struct. This makes it more clear what information postmaster initializes, and what is left to the child process. Rename the StreamServerPort and StreamConnection functions to make it more clear what they do. Remove StreamClose, replacing it with plain closesocket() calls. Reviewed-by: Tristan Partin, Andres Freund Discussion: https://www.postgresql.org/message-id/7a59b073-5b5b-151e-7ed3-8b01ff7ce9ef@iki.fi --- src/backend/tcop/postgres.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index aec1b194424..6b7903314ab 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -4233,10 +4233,7 @@ PostgresMain(const char *dbname, const char *username) /* * If the PostmasterContext is still around, recycle the space; we don't - * need it anymore after InitPostgres completes. Note this does not trash - * *MyProcPort, because ConnCreate() allocated that space with malloc() - * ... else we'd need to copy the Port data first. Also, subsidiary data - * such as the username isn't lost either; see ProcessStartupPacket(). + * need it anymore after InitPostgres completes. */ if (PostmasterContext) { -- cgit v1.2.3