[chord] error in chord/dhash?

Cosmin Arad aradione at comp.nus.edu.sg
Thu Apr 15 17:16:05 EDT 2004


Hello,

This is an excerpt from 
http://cvs.pdos.lcs.mit.edu/cvs/sfsnet/dhash/server.C

int
dhash_impl::db_insert_immutable (ref<dbrec> key, ref<dbrec> data,
                                  dhash_ctype ctype)
{
   char *action;
   block blk (to_merkle_hash (key), data);
   bool exisata, (database_lookup (mtree->db, blk.key) != 0L);
   int ret = 0;
   if (!exists) {
     action = "N"; // New
     ret = mtree->insert (&blk);
   }
   else
     action = "R"; // Re-write

   // Won't deal well if there's a magic expansion in the encoding
   // vector.  Should really know how big the full block is so that
   // the right amount of the key's encoding vector is extracted...
   str x ("");
   if (key->isFrag() &&
       (u_long) data->len > 9 + 2 * num_dfrags ())
     x = strbuf () << " " << hexdump (data->value + 8, 2*(num_dfrags () 
+ 1));
   info << "db write: " << host_node->my_ID ()
        << " " << action << " " << dbrec2id(key) << x << "\n";
   return ret;
}

Isn't the line "bool exisata, (database_lookup (mtree->db, blk.key) != 
0L);" wrong?

Thank you,
Cosmin Arad

PS

I saw that survived from revision 1.176 till 1.215



More information about the chord mailing list