<commit_before>#include "vpn-ws.h"

void vpn_ws_peer_destroy(vpn_ws_peer *peer) {
	vpn_ws_log("removing peer %X:%X:%X:%X:%X:%X (fd: %d)\n", peer->mac[0],
                        peer->mac[1],
                        peer->mac[2],
                        peer->mac[3],
                        peer->mac[4],
                        peer->mac[5], peer->fd);
	int fd = peer->fd;
	if (peer->buf) free(peer->buf);
	free(peer);

	if (vpn_ws_conf.peers)
		vpn_ws_conf.peers[fd] = NULL;

	if (fd > -1)
		close(fd);
}

void *vpn_ws_malloc(uint64_t amount) {
	void *ptr = malloc(amount);
	if (ptr == NULL) {
		vpn_ws_error("vpn_ws_malloc()/malloc()");
		return NULL;
	}
	return ptr;
}

void *vpn_ws_calloc(uint64_t amount) {
        void *ptr = calloc(1, amount);
        if (ptr == NULL) {
                vpn_ws_error("vpn_ws_malloc()/calloc()");
                return NULL;
        }
        return ptr;
}
<commit_msg>do not report peer removal on client<commit_after>#include "vpn-ws.h"

void vpn_ws_peer_destroy(vpn_ws_peer *peer) {
	int fd = peer->fd;
	
	if (fd > -1) {
		vpn_ws_log("removing peer %2.X:%2.X:%2.X:%2.X:%2.X:%2.X (fd: %d)\n", peer->mac[0],
                        peer->mac[1],
                        peer->mac[2],
                        peer->mac[3],
                        peer->mac[4],
                        peer->mac[5], peer->fd);
		close(fd);
	}

	if (peer->buf) free(peer->buf);
	free(peer);

	if (vpn_ws_conf.peers)
		vpn_ws_conf.peers[fd] = NULL;
}

void *vpn_ws_malloc(uint64_t amount) {
	void *ptr = malloc(amount);
	if (ptr == NULL) {
		vpn_ws_error("vpn_ws_malloc()/malloc()");
		return NULL;
	}
	return ptr;
}

void *vpn_ws_calloc(uint64_t amount) {
        void *ptr = calloc(1, amount);
        if (ptr == NULL) {
                vpn_ws_error("vpn_ws_malloc()/calloc()");
                return NULL;
        }
        return ptr;
}

{'fraction_non_alphanumeric': 0.17050938337801608, 'fraction_numerical': 0.0160857908847185, 'mean_word_length': 1.9856, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2072638', 'n_tokens_mistral': 756, 'n_tokens_neox': 720, 'n_words': 128}