[LON-CAPA-cvs] cvs: loncom / LondConnection.pm loncnew lond lonlocal.pm lonssl.pm

foxr lon-capa-cvs@mail.lon-capa.org
Thu, 17 Jun 2004 10:15:47 -0000


foxr		Thu Jun 17 06:15:47 2004 EDT

  Modified files:              
    /loncom	LondConnection.pm loncnew lond lonlocal.pm lonssl.pm 
  Log:
  Turn down the logging volume now that the ssl stuff looks like it's functional.
  
  
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.31 loncom/LondConnection.pm:1.32
--- loncom/LondConnection.pm:1.31	Thu Jun 17 05:26:09 2004
+++ loncom/LondConnection.pm	Thu Jun 17 06:15:46 2004
@@ -1,7 +1,7 @@
 #   This module defines and implements a class that represents
 #   a connection to a lond daemon.
 #
-# $Id: LondConnection.pm,v 1.31 2004/06/17 09:26:09 foxr Exp $
+# $Id: LondConnection.pm,v 1.32 2004/06/17 10:15:46 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -42,7 +42,7 @@
 
 
 
-my $DebugLevel=11;
+my $DebugLevel=0;
 my %hostshash;
 my %perlvar;
 my $LocalDns = "";		# Need not be defined for managers.
@@ -153,6 +153,12 @@
 
 sub Dump {
     my $self   = shift;
+    my $level  = shift;
+    
+    if ($level <= $DebugLevel) {
+	return;
+    }
+
     my $key;
     my $value;
     print STDERR "Dumping LondConnectionObject:\n";
@@ -315,7 +321,7 @@
     # return the object :
 
     Debug(9, "Initial object state: ");
-    $self->Dump();
+    $self->Dump(9);
 
     return $self;
 }
@@ -978,7 +984,7 @@
     if($cipher) {
 	$self->{Cipher} = $cipher;
 	Debug("Cipher created  dumping socket: ");
-	$self->Dump();
+	$self->Dump(9);
 	return 1;
     }
     else {
Index: loncom/loncnew
diff -u loncom/loncnew:1.47 loncom/loncnew:1.48
--- loncom/loncnew:1.47	Tue Jun  1 06:02:13 2004
+++ loncom/loncnew	Thu Jun 17 06:15:46 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # lonc maintains the connections to remote computers
 #
-# $Id: loncnew,v 1.47 2004/06/01 10:02:13 foxr Exp $
+# $Id: loncnew,v 1.48 2004/06/17 10:15:46 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -232,7 +232,7 @@
     my ($level, $socket) = @_;
 
     if($level <= $DebugLevel) {
-	$socket->Dump();
+	$socket->Dump(-1);	# Ensure it will get dumped.
     }
 }
 
@@ -265,7 +265,7 @@
     my $Socket = shift;
     Log("WARNING", "A socket timeout was detected");
     Debug(0, " SocketTimeout called: ");
-    $Socket->Dump();
+    $Socket->Dump(0);
     if(exists($ActiveTransactions{$Socket})) {
 	FailTransaction($ActiveTransactions{$Socket});
     }
@@ -1441,7 +1441,7 @@
 	    my $state  = $Socket->GetState();
 	    print $fh "Connection $i State: $state\n";
 	    print STDERR "---------------------- Connection $i \n";
-	    $Socket->Dump();
+	    $Socket->Dump(-1);	# Ensure it gets dumped..
 	    $i++;	
 	}
     }
Index: loncom/lond
diff -u loncom/lond:1.194 loncom/lond:1.195
--- loncom/lond:1.194	Thu Jun 17 05:26:56 2004
+++ loncom/lond	Thu Jun 17 06:15:46 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.194 2004/06/17 09:26:56 foxr Exp $
+# $Id: lond,v 1.195 2004/06/17 10:15:46 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -51,12 +51,12 @@
 use LONCAPA::lonlocal;
 use LONCAPA::lonssl;
 
-my $DEBUG = 1;		       # Non zero to enable debug log entries.
+my $DEBUG = 0;		       # Non zero to enable debug log entries.
 
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.194 $'; #' stupid emacs
+my $VERSION='$Revision: 1.195 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
Index: loncom/lonlocal.pm
diff -u loncom/lonlocal.pm:1.5 loncom/lonlocal.pm:1.6
--- loncom/lonlocal.pm:1.5	Thu Jun 17 05:27:23 2004
+++ loncom/lonlocal.pm	Thu Jun 17 06:15:46 2004
@@ -1,5 +1,5 @@
 #
-# $Id: lonlocal.pm,v 1.5 2004/06/17 09:27:23 foxr Exp $
+# $Id: lonlocal.pm,v 1.6 2004/06/17 10:15:46 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -58,7 +58,7 @@
 
 #  Debugging:
 
-my $DEBUG = 1;
+my $DEBUG = 0;
 
 sub Debug {
     my $msg = shift;
Index: loncom/lonssl.pm
diff -u loncom/lonssl.pm:1.8 loncom/lonssl.pm:1.9
--- loncom/lonssl.pm:1.8	Thu Jun 17 05:27:38 2004
+++ loncom/lonssl.pm	Thu Jun 17 06:15:46 2004
@@ -1,5 +1,5 @@
 #
-# $Id: lonssl.pm,v 1.8 2004/06/17 09:27:38 foxr Exp $
+# $Id: lonssl.pm,v 1.9 2004/06/17 10:15:46 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -52,6 +52,8 @@
 
 my $pathsep = "/";		# We're on unix after all.
 
+my $DEBUG = 0;			# Set to non zero to enable debug output.
+
 
 # Initialization code:
 
@@ -61,10 +63,18 @@
 my $lasterror="";
 
 
+
 sub LastError {
     return $lasterror;
 }
 
+sub Debug {
+    my $msg  = shift;
+    if ($DEBUG) {
+	print STDERR $msg;
+    }
+}
+
 #-------------------------------------------------------------------------
 # Name SetFdBlocking - 
 #      Turn blocking mode on on the file handle.  This is required for
@@ -76,18 +86,18 @@
 #      prior flag settings.
 #
 sub SetFdBlocking {
-    print STDERR "SetFdBlocking called \n";
+    Debug("SetFdBlocking called \n");
     my $Handle = shift;
 
 
 
     my $flags  = fcntl($Handle, F_GETFL, 0);
     if(!$flags) {
-	print STDERR "SetBLocking fcntl get faild $!\n";
+	Debug("SetBLocking fcntl get faild $!\n");
     }
     my $newflags  = $flags & (~ O_NONBLOCK); # Turn off O_NONBLOCK...
     if(!fcntl($Handle, F_SETFL, $newflags)) {
-	print STDERR "Can't set non block mode  $!\n";
+	Debug("Can't set non block mode  $!\n");
     }
     return $flags;
 }
@@ -119,7 +129,7 @@
 	$KeyFile)          = @_;
     
     
-    print STDERR "Client promotion using key: $KeyFile, Cert: $MyCert, CA: $CACert\n";
+    Debug("Client promotion using key: $KeyFile, Cert: $MyCert, CA: $CACert\n");
 
     # To create the ssl socket we need to duplicate the existing
     # socket.  Otherwise closing the ssl socket will close the plaintext socket
@@ -129,7 +139,7 @@
 
     my $oldflags = SetFdBlocking($PlaintextSocket);
     my $dupfno   = fcntl($PlaintextSocket, F_DUPFD, 0);
-    print STDERR "Client promotion got dup = $dupfno\n";
+    Debug("Client promotion got dup = $dupfno\n");
 
     
     my $client = IO::Socket::SSL->new_from_fd($dupfno,
@@ -176,14 +186,14 @@
     # socket.  Otherwise closing the ssl socket will close the plaintext socket
     # too:
 
-    print STDERR "Server promotion: Key = $KeyFile, Cert $MyCert CA $CACert\n";
+    Debug("Server promotion: Key = $KeyFile, Cert $MyCert CA $CACert\n");
  
     my $oldflags = SetFdBlocking($PlaintextSocket);
     my $dupfno   = fcntl($PlaintextSocket, F_DUPFD, 0);
     if (!$dupfno) {
-	print STDERR "dup failed: $!\n";
+	Debug("dup failed: $!\n");
     }
-    print STDERR " Fileno = $dupfno\n";
+    Debug(" Fileno = $dupfno\n");
     my $client = IO::Socket::SSL->new_from_fd($dupfno,
 					      SSL_server    => 1, # Server role.
 					      SSL_user_cert => 1,