nserver

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 0d20c8e6a50acfdd177288370d1d3e4c2caef673
parent bada83f66662e1a8c95888280d6a228b4da9ded2
Author: rsiddharth <s@ricketyspace.net>
Date:   Tue, 25 Feb 2020 21:04:30 -0500

nserver/src/protocol.c: Update ssdelete.

* nserver/src/protocol.c (ssdelete): Clear Stats record.
(sscreate): Allocated fresh Stats record for deleted key that's added
back again.

Diffstat:
nserver/src/protocol.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/nserver/src/protocol.c b/nserver/src/protocol.c @@ -17,6 +17,10 @@ int sscreate(char *key) if (rec != NULL && rec->deleted == 1) { rec->deleted = 0; + // Allocate fresh Stats. + rec->st = Stats_create(); + check(rec->st != NULL, "stats creation failed"); + return 2; } @@ -60,6 +64,9 @@ int ssdelete(char *key) // Mark as deleted. rec->deleted = 1; + // Free Stats. + free(rec->st); + return 0; error: return -1;