[LON-CAPA-cvs] cvs: loncom(version_2_3_X) /lonnet/perl lonnet.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 02 May 2007 22:01:34 -0000


albertel		Wed May  2 18:01:34 2007 EDT

  Modified files:              (Branch: version_2_3_X)
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - backport 1.872
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.824.2.4 loncom/lonnet/perl/lonnet.pm:1.824.2.5
--- loncom/lonnet/perl/lonnet.pm:1.824.2.4	Tue Apr 24 15:38:15 2007
+++ loncom/lonnet/perl/lonnet.pm	Wed May  2 18:01:32 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.824.2.4 2007/04/24 19:38:15 albertel Exp $
+# $Id: lonnet.pm,v 1.824.2.5 2007/05/02 22:01:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -992,7 +992,10 @@
 my $hits=0;
 sub make_key {
     my ($name,$id) = @_;
-    if (length($id) > 200) { $id=length($id).':'.&Digest::MD5::md5_hex($id); }
+    if (length($id) > 65 
+	&& length(&escape($id)) > 200) {
+	$id=length($id).':'.&Digest::MD5::md5_hex($id);
+    }
     return &escape($name.':'.$id);
 }
 
@@ -1039,7 +1042,9 @@
 	$time=600;
     }
     if ($debug) { &Apache::lonnet::logthis("Setting $id to $value"); }
-    $memcache->set($id,$setvalue,$time);
+    if (!($memcache->set($id,$setvalue,$time))) {
+	&logthis("caching of id -> $id  failed");
+    }
     # need to make a copy of $value
     #&make_room($id,$value,$debug);
     return $value;