[LON-CAPA-cvs] cvs: loncom / loncnew

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 19 Jul 2006 19:56:26 -0000


albertel		Wed Jul 19 15:56:26 2006 EDT

  Modified files:              
    /loncom	loncnew 
  Log:
  - BUG#4927 - delayed messages were not being noticed after the host name transition
  
  
Index: loncom/loncnew
diff -u loncom/loncnew:1.74 loncom/loncnew:1.75
--- loncom/loncnew:1.74	Fri Jan 27 15:37:12 2006
+++ loncom/loncnew	Wed Jul 19 15:56:26 2006
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # lonc maintains the connections to remote computers
 #
-# $Id: loncnew,v 1.74 2006/01/27 20:37:12 albertel Exp $
+# $Id: loncnew,v 1.75 2006/07/19 19:56:26 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1164,19 +1164,28 @@
 
     Debug(4, "Delayed path: ".$path);
     opendir(DIRHANDLE, $path);
-    
-    my @alldelayed = grep /\.$RemoteHost$/, readdir DIRHANDLE;
+
+    my @all_host_ids;
+    my $host_iterator =   &LondConnection::GetHostIterator();
+    while (!$host_iterator->end()) {
+	my ($host_id,$host_name) = @{$host_iterator->get()}[0,3];
+	if ($host_name eq $RemoteHost) {
+	    push(@all_host_ids, $host_id);
+	}
+	$host_iterator->next();
+    }
+    my $host_id_re = '(?:'.join('|',@all_host_ids).')';
+    my @alldelayed = grep(/\.$host_id_re$/, readdir(DIRHANDLE));
     closedir(DIRHANDLE);
-    my $dfname;
-    my $reqfile;
-    foreach $dfname (sort  @alldelayed) {
-	$reqfile = "$path/$dfname";
-	Debug(4, "queueing ".$reqfile);
+    foreach my $dfname (sort(@alldelayed)) {
+	my $reqfile = "$path/$dfname";
+	my ($host_id) = ($dfname =~ /\.([^.]*)$/);
+	Debug(4, "queueing ".$reqfile." for $host_id");
 	my $Handle = IO::File->new($reqfile);
 	my $cmd    = <$Handle>;
 	chomp $cmd;		# There may or may not be a newline...
 	$cmd = $cmd."\n";	# now for sure there's exactly one newline.
-	my $Transaction = LondTransaction->new($cmd);
+	my $Transaction = LondTransaction->new("sethost:$host_id:$cmd");
 	$Transaction->SetDeferred($reqfile);
 	QueueTransaction($Transaction);
     }