SVN Commit by dpage: r4226 - trunk/pgadmin3/xtra/pgagent

From: svn(at)pgadmin(dot)org
To: pgadmin-hackers(at)postgresql(dot)org
Subject: SVN Commit by dpage: r4226 - trunk/pgadmin3/xtra/pgagent
Date: 2005-05-20 11:25:24
Message-ID: 200505201125.j4KBPOGT024559@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Author: dpage
Date: 2005-05-20 12:25:24 +0100 (Fri, 20 May 2005)
New Revision: 4226

Modified:
trunk/pgadmin3/xtra/pgagent/connection.cpp
Log:
Only clear down connections that are not in use.

Modified: trunk/pgadmin3/xtra/pgagent/connection.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/connection.cpp 2005-05-20 09:29:33 UTC (rev 4225)
+++ trunk/pgadmin3/xtra/pgagent/connection.cpp 2005-05-20 11:25:24 UTC (rev 4226)
@@ -142,7 +142,7 @@
if (all)
LogMessage("Clearing all connections", LOG_DEBUG);
else
- LogMessage("Clearing all connections except the primary", LOG_DEBUG);
+ LogMessage("Clearing inactive connections", LOG_DEBUG);

DBconn *thisConn=primaryConn, *deleteConn;

@@ -151,12 +151,27 @@
thisConn = thisConn->next;

// Delete connections as required
+ // If a connection is not in use, delete it, and reset the next and previous
+ // pointers appropriately. If it is in use, don't touch it.
while (thisConn->prev != 0)
{
- deleteConn = thisConn;
- thisConn = deleteConn->prev;
- delete deleteConn;
- thisConn->next = 0;
+ if ((!thisConn->inUse) || all)
+ {
+ deleteConn = thisConn;
+
+ thisConn = deleteConn->prev;
+
+ thisConn->next = deleteConn->next;
+
+ if (deleteConn->next)
+ deleteConn->next->prev = deleteConn->prev;
+
+ delete deleteConn;
+ }
+ else
+ {
+ thisConn = thisConn->prev;
+ }
}

if (all)

Browse pgadmin-hackers by date

  From Date Subject
Next Message Jyrki Wahlstedt 2005-05-20 12:11:12 pgAdmin3.app library problem
Previous Message Dave Page 2005-05-20 10:28:45 Re: 1.2.2 testing