diff options
| -rw-r--r-- | main.c | 14 | 
1 files changed, 2 insertions, 12 deletions
| @@ -58,29 +58,19 @@ static void delete_conn_data(int fd){  	debug("Deleting conn_data for fd=%d",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); -			broadcast_online_change(item->cd.userid); -		} -		conn_hash[fd%CONN_HASH_SIZE]=item->next; -		conn_data_nullify(&item->cd); -		free(item); -		return; -	}  	struct hash_item *parent=NULL;  	while(item&&item->cd.fd!=fd){  		parent=item;  		item=item->next;  	} -	assert(parent);  	assert(item);  	if(item->cd.userid!=-1){  		userdata_unregister(item->cd.userid,fd);  		broadcast_online_change(item->cd.userid);  	}  	conn_data_nullify(&item->cd); -	parent->next=item->next; +	if(parent)parent->next=item->next; +	else conn_hash[fd%CONN_HASH_SIZE]=item->next;  	free(item);  } | 
