summaryrefslogtreecommitdiffstats
path: root/nserver/src/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'nserver/src/protocol.c')
-rw-r--r--nserver/src/protocol.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/nserver/src/protocol.c b/nserver/src/protocol.c
index 0d254cd..6963116 100644
--- a/nserver/src/protocol.c
+++ b/nserver/src/protocol.c
@@ -16,8 +16,22 @@ int ssinit()
int sscreate(char *key)
{
+ int rc = 0;
+
check(ssinit() == 0, "ssinit failed");
+ // 1. create bstring from 'key'.
+ bstring k = bfromcstr(key);
+ check(k != NULL, "key creation failed");
+
+ // 2. allocate fresh Stats.
+ Stats *st = Stats_create();
+ check(st != NULL, "stats creation failed");
+
+ // 3. add to hashmap.
+ rc = Hashmap_set(hash, k, st);
+ check(rc == 0, "hashmap set failed");
+
return 0;
error:
return -1;