Move initialization of the Port struct to the child process
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 12 Mar 2024 11:42:38 +0000 (13:42 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 12 Mar 2024 11:42:38 +0000 (13:42 +0200)
commit4945e4ed4a72c3ff41560ccef722c3d70ae07dbb
treef5e98b8bc2cc4734e02b0bca72e98bf7ddeec616
parentd162c3a73bf14416ff4012de6f01c3d825610f70
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/libpq/pqcomm.c
src/backend/postmaster/postmaster.c
src/backend/tcop/postgres.c
src/include/libpq/libpq-be.h
src/include/libpq/libpq.h
src/tools/pgindent/typedefs.list