[LON-CAPA-cvs] cvs: newloncapa /types LondConnection.pm

foxr lon-capa-cvs@mail.lon-capa.org
Sat, 12 Apr 2003 02:47:00 -0000


foxr		Fri Apr 11 22:47:00 2003 EDT

  Modified files:              
    /newloncapa/types	LondConnection.pm 
  Log:
  Add GetHostIterator - return a HashIterator to the hosts table hash.  This can
  be picked up e.g. lonc master process to figure out what it has to fork off.
  
  
  
Index: newloncapa/types/LondConnection.pm
diff -u newloncapa/types/LondConnection.pm:1.5 newloncapa/types/LondConnection.pm:1.6
--- newloncapa/types/LondConnection.pm:1.5	Tue Apr  8 21:08:14 2003
+++ newloncapa/types/LondConnection.pm	Fri Apr 11 22:47:00 2003
@@ -2,6 +2,8 @@
 #   This module defines and implements a class that represents
 #   a connection to a lond daemon. 
 package LondConnection;
+use lib "/home/fox/newloncapa/types"; # kludge for now.
+use lib "/home/httpd/lib/perl";	# Kludge too.
 use IO::Socket;
 use IO::Socket::INET;
 use IO::Handle;
@@ -9,9 +11,11 @@
 use Fcntl;
 use POSIX;
 use Crypt::IDEA;
-use LONCAPA::Configuration;
+#use LONCAPA::Configuration;
+use Configuration;
+use HashIterator;
 
-my $DebugLevel=10;
+my $DebugLevel=1;
 
 #   Read the configuration file for apache to get the perl
 #   variable set.
@@ -499,6 +503,31 @@
     return $decrypted;
 
 }
+
+=pod
+=head GetHostIterator
+
+Returns a hash iterator to the host information.  Each get from 
+this iterator returns a reference to an array that contains 
+information read from the hosts configuration file.  Array elements
+are used as follows:
+
+[0]   - LonCapa host name.
+[1]   - LonCapa domain name.
+[2]   - Loncapa role (e.g. library or access).
+[3]   - DNS name server hostname.
+[4]   - IP address (result of e.g. nslooup [3]).
+[5]   - Maximum connection count.
+[6]   - Idle timeout for reducing connection count.
+[7]   - Minimum connection count.
+
+
+=cut
+sub GetHostIterator {
+
+    return HashIterator->new(\%hostshash);    
+}
+
 1;
 
 =pod
@@ -564,5 +593,5 @@
 =item WantReadable: true if the current state requires a readable event.
 =item WantWritable: true if the current state requires a writable event.
 =item WantTimeout: true if the current state requires timeout support.
-
+=item GetHostIterator: Returns an iterator into the host file hash.
 =cut