diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-03-16 21:06:11 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-03-16 21:06:57 +0100 |
commit | 047e1828901b5b08cd538a7b11c0de2149606797 (patch) | |
tree | 9249612fe9bb88bf3063733744a6c02c391e5739 /main.c | |
parent | a441b302c2c11c291df60fe642ec0d51646218dd (diff) |
Basic message sending
TODO: broadcast to all online fd's of a user?
TODO: close users that aren't reachable in a broadcast?
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -10,6 +10,7 @@ #include "conn_data.h" #include "db.h" #include "runloop.h" +#include "user_data.h" #define PORT (29536) // python: int("msg",36) @@ -50,6 +51,7 @@ static void delete_conn_data(int fd){ struct hash_item *item=conn_hash[fd%CONN_HASH_SIZE]; assert(item); if(item->cd.fd==fd){ + if(item->cd.userid!=-1)userdata_unregister(item->cd.userid,fd); conn_hash[fd%CONN_HASH_SIZE]=item->next; conn_data_nullify(&item->cd); free(item); @@ -62,6 +64,7 @@ static void delete_conn_data(int fd){ } assert(parent); assert(item); + if(item->cd.userid!=-1)userdata_unregister(item->cd.userid,fd); conn_data_nullify(&item->cd); parent->next=item->next; free(item); |