From c53611e3e7dc74c0c7dd79c78873fda1887f5b7f Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 17 Feb 2004 03:54:57 +0000 Subject: This patch brings up to date what I did last year (now unfortunately bitrotted) to allow the logging of the end of a session, enabled by the config setting "log_disconnections". Andrew Dunstan --- src/backend/postmaster/postmaster.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/backend/postmaster') diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 2809cd9f5ed..ab9af54bac3 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.366 2004/02/11 22:25:02 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.367 2004/02/17 03:54:56 momjian Exp $ * * NOTES * @@ -2428,6 +2428,13 @@ BackendInit(Port *port) * Signal handlers setting is moved to tcop/postgres... */ + /* save start time for end of session reporting */ + gettimeofday(&(port->session_start),NULL); + + /* set these to empty in case they are needed before we set them up */ + port->remote_host = ""; + port->remote_port = ""; + /* Save port etc. for ps status */ MyProcPort = port; @@ -2483,6 +2490,12 @@ BackendInit(Port *port) StrNCpy(remote_host, tmphost, sizeof(remote_host)); } + /* + * save remote_host and remote_port in port stucture + */ + port->remote_host = strdup(remote_host); + port->remote_port = strdup(remote_port); + /* * Ready to begin client interaction. We will give up and exit(0) * after a time delay, so that a broken client can't hog a connection -- cgit v1.2.3