diff options
-rw-r--r-- | nserver/src/protocol.c | 14 | ||||
-rw-r--r-- | nserver/tests/protocol_tests.c | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/nserver/src/protocol.c b/nserver/src/protocol.c index da4141a..205d994 100644 --- a/nserver/src/protocol.c +++ b/nserver/src/protocol.c @@ -143,17 +143,17 @@ double ssmean(char *key) char *ssdump(char *key) { - check(hash != NULL, "hash not initialized"); + check(key != NULL || strlen(key) < 1, "key invalid"); + check(tst != NULL, "tstree not initialized"); // 1. create bstring from 'key'. - bstring k = bfromcstr(key); + Record *rec = (Record *) TSTree_search(tst, key, strlen(key)); - // 2. try to get Stats for key. - Stats *st = (Stats *) Hashmap_get(hash, k); - check(st != NULL, "stats not found for key"); + check(rec != NULL, "record not found"); + check(rec->st != NULL, "stats not found for key"); - // 3. get dump. - char *dstr = Stats_dump(st); + // 2. get dump. + char *dstr = Stats_dump(rec->st); check(dstr != NULL, "dump failed for key"); return dstr; diff --git a/nserver/tests/protocol_tests.c b/nserver/tests/protocol_tests.c index 6e50ee5..ab50f9b 100644 --- a/nserver/tests/protocol_tests.c +++ b/nserver/tests/protocol_tests.c @@ -74,7 +74,7 @@ char *test_ssdump() { char *dstr = NULL; - dstr = ssdump("crimson"); + dstr = ssdump("/crimson"); mu_assert(dstr != NULL, "ssdump failed 0"); debug("DUMP: %s", dstr); @@ -133,8 +133,8 @@ char *all_tests() mu_run_test(test_sssample); mu_run_test(test_ssmean); mu_run_test(test_ssdump); - mu_run_test(test_sslist); - mu_run_test(test_ssdelete); + /*mu_run_test(test_sslist); + mu_run_test(test_ssdelete);*/ return NULL; } |