[chord] retrieve data with no authentication

=?GB2312?Q?=CE=E4=D1=DE=BE=FC?= wuyanjun at mprc.pku.edu.cn
Tue May 17 08:35:53 EDT 2005


Hi, Emil
	I want to use dhash to store some data pairs such as userid/ip and retrieve ip by userid. Here, I take the userid as key, so DHASH_NOAUTH type of insert&retrieve operation was selected. The insert operation has no problem, but there is something wrong with the retrieve operation.
	The example in dhash_benchmark.C are of DHASH_CONTENTHASH type , so I need your help.
	The source code is as follows, it displays "verification failed" after execution:


s_dht::cb_get (dhash_stat status, ptr<dhash_block> blk, vec<chordID> path)
{
        if(!blk)
                warn << "cb_get:" <<"error\n";
        else if(blk->len != 5 || memcmp (buf, blk->data, 5) != 0)
                fatal << "verification failed\n";
        else
                warn << "fetch ok\n";
}

s_dht::dht_get()
{
        str sockname = siphone_dht::get_sockname();
        dhashclient * dhash = New dhashclient(sockname);

        bigint key = siphone_dht::siphone_key_to_bigint(skey);

        async_init();
        dhash->retrieve(key, DHASH_NOAUTH, wrap(this, &siphone_dht::cb_get), NULL);
        amain();

        return true;
}

	thanks!
   
				Wu Yanjun
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡wuyanjun at mprc.pku.edu.cn
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2005-05-17





More information about the chord mailing list