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,10 +102,12 @@ static void add_record(){
static void respond(char *token, struct item *item){ static void respond(char *token, struct item *item){
if (!item) if (!item)
return; return;
respond(token, item->_left); if (item->_left && strcmp(item->key, item->_left->key)==0)
respond(token, item->_left);
if (item->expires > gettime_ms()) if (item->expires > gettime_ms())
printf("%s|%s|\n",token,item->value); printf("%s|%s|\n",token,item->value);
respond(token, item->_right); if (item->_right && strcmp(item->key, item->_right->key)==0)
respond(token, item->_right);
} }
static void process_line(char *line){ static void process_line(char *line){