aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-12 13:42:38 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-12 13:42:38 +0200
commit4945e4ed4a72c3ff41560ccef722c3d70ae07dbb (patch)
treef5e98b8bc2cc4734e02b0bca72e98bf7ddeec616 /src/backend/tcop/postgres.c
parentd162c3a73bf14416ff4012de6f01c3d825610f70 (diff)
downloadpostgresql-4945e4ed4a72c3ff41560ccef722c3d70ae07dbb.tar.gz
postgresql-4945e4ed4a72c3ff41560ccef722c3d70ae07dbb.zip
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
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c5
1 files changed, 1 insertions, 4 deletions
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)
{