From 3e7c41d8e3190c2576db13cc43543fb07957e2f1 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 8 Aug 2020 12:10:28 +0200 Subject: server: Debug logging in user_data.c Trying to find the bug leading to "userdata_unregister while nonexistent" errors in production --- user_data.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/user_data.c b/user_data.c index 125a6b4..a69ec78 100644 --- a/user_data.c +++ b/user_data.c @@ -23,6 +23,7 @@ static void userdata_constructor() { void userdata_register(i64 userid,int fd){ struct user_data *data=ht_find(user_hash, userid); if(data){ + debug("userdata_register(%" PRIi64 ", %d) -> new fd",userid,fd); for(i64 i=0;ilen;i++){ if(data->fds[i]==fd){ die("userdata_register(%" PRIi64 ", %d) while pair already existed",userid,fd); @@ -37,6 +38,7 @@ void userdata_register(i64 userid,int fd){ data->last_active[data->len]=make_timestamp(); data->len++; } else { + debug("userdata_register(%" PRIi64 ", %d) -> new userid",userid,fd); data=malloc(1, struct user_data); data->userid=userid; data->cap=2; @@ -50,6 +52,7 @@ void userdata_register(i64 userid,int fd){ } void userdata_unregister(i64 userid,int fd){ + debug("userdata_unregister(%" PRIi64 ", %d)",userid,fd); struct user_data *data=ht_find(user_hash,userid); if(!data){ die("userdata_unregister(%" PRIi64 ", %d) while nonexistent",userid,fd); -- cgit v1.2.3-70-g09d2