aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-08-08 12:10:28 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-08-08 12:10:28 +0200
commit3e7c41d8e3190c2576db13cc43543fb07957e2f1 (patch)
tree52af63426124f6e321ed3f0c34f8ca83b6ebe7d5
parente73a9e714f86e34ede60da3f4ccdecb91c31983e (diff)
server: Debug logging in user_data.c
Trying to find the bug leading to "userdata_unregister while nonexistent" errors in production
-rw-r--r--user_data.c3
1 files changed, 3 insertions, 0 deletions
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;i<data->len;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);