Only respond with multiple matches if the key is the same

This commit is contained in:
Jeremy Lakeman 2012-11-12 11:12:21 +10:30
parent 9669cda2b2
commit 3c69a45d42

View File

@ -102,9 +102,11 @@ static void add_record(){
static void respond(char *token, struct item *item){
if (!item)
return;
if (item->_left && strcmp(item->key, item->_left->key)==0)
respond(token, item->_left);
if (item->expires > gettime_ms())
printf("%s|%s|\n",token,item->value);
if (item->_right && strcmp(item->key, item->_right->key)==0)
respond(token, item->_right);
}