--- loncom/loncnew	2003/11/21 19:27:18	1.32
+++ loncom/loncnew	2003/12/15 23:30:57	1.36
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # lonc maintains the connections to remote computers
 #
-# $Id: loncnew,v 1.32 2003/11/21 19:27:18 albertel Exp $
+# $Id: loncnew,v 1.36 2003/12/15 23:30:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -210,7 +210,6 @@ sub GetPeername {
 	return $peerfile;
     }
 }
-#----------------------------- Timer management ------------------------
 =pod
 
 =head2 Debug
@@ -267,6 +266,7 @@ sub SocketTimeout {
                                 # a connection failure:
     $ConnectionRetriesLeft--;
 }
+#----------------------------- Timer management ------------------------
 
 =pod
 
@@ -301,9 +301,13 @@ sub Tick {
     #
     #  For each inflight transaction, tick down its timeout counter.
     #
-    foreach my $item (keys %ActiveTransactions) {
-	my $Socket = $ActiveTransactions{$item}->getServer();
-	$Socket->Tick();
+
+    foreach my $item (keys %ActiveConnections) {
+	my $State = $ActiveConnections{$item}->data->GetState();
+	if ($State ne 'Idle') {
+	    Debug(5,"Ticking Socket $State $item");
+	    $ActiveConnections{$item}->data->Tick();
+	}
     }
     # Do we have work in the queue, but no connections to service them?
     # If so, try to make some new connections to get things going again.
@@ -350,7 +354,7 @@ Trigger disconnections of idle sockets.
 
 sub SetupTimer {
     Debug(6, "SetupTimer");
-    Event->timer(interval => 1, debug => 1, cb => \&Tick );
+    Event->timer(interval => 1, cb => \&Tick );
 }
 
 =pod
@@ -653,7 +657,7 @@ sub KillSocket {
 	delete($ActiveConnections{$Socket});
     }
     $ConnectionCount--;
-
+    if ($ConnectionCount < 0) { $ConnectionCount = 0; }
     #  If the connection count has gone to zero and there is work in the
     #  work queue, the work all gets failed with con_lost.
     #