<commit_before>#include <server.h>
#include <stats.h>

void mark_pending_event_invalid(void *sptr)
{
	int i;
	for (i = 0; i < event_count; i++) {
		if (cur_events[i].data.ptr == sptr)
			cur_events[i].events = 0;
	}
}

int read_event_handler(server_info_t *server, int efd)
{
	struct sockaddr_in c_addr;
	int c_len, read_len;
	int accepted_fd;
	server_info_t *client_info;
	server->read_events++;
	switch (server->server_flags) {
		case LB_SERVER: 
		{
			c_len = sizeof(c_addr);
			if (0 > (accepted_fd = accept(server->fd, (struct sockaddr *)&c_addr, &c_len)))
				ASSERT(0);
			if (client_info = create_client_info(efd, accepted_fd)) {
				insert_client_info(client_info);
			}
			break;
		}
		case STATS_SERVER:
		{
			c_len = sizeof(c_addr);
			if (0 > (accepted_fd = accept(server->fd, (struct sockaddr *)&c_addr, &c_len)))
				ASSERT(0);
			if (client_info = create_client_info(efd, accepted_fd))
				client_info->server_flags |= STATS_CONN;
			break;
		}
		default:
		{
			if (!(server->server_flags & STATS_CONN) &&
			    NULL == server->session->server) {
				if (0 > attach_backend_lbserver(efd, client_info)) {
					close_client_pconn(client_info);
					lb_server->tot_unhandled_conn++;
				} else {
					lb_server->cur_conn++;
				}
			}
			ASSERT(server->session->buf_len <= BUF_LEN);
			int start, end;<commit_msg>fixing copy paste error in "protecting servers DDoS attack"<commit_after>#include <server.h>
#include <stats.h>

void mark_pending_event_invalid(void *sptr)
{
	int i;
	for (i = 0; i < event_count; i++) {
		if (cur_events[i].data.ptr == sptr)
			cur_events[i].events = 0;
	}
}

int read_event_handler(server_info_t *server, int efd)
{
	struct sockaddr_in c_addr;
	int c_len, read_len;
	int accepted_fd;
	server_info_t *client_info;
	server->read_events++;
	switch (server->server_flags) {
		case LB_SERVER: 
		{
			c_len = sizeof(c_addr);
			if (0 > (accepted_fd = accept(server->fd, (struct sockaddr *)&c_addr, &c_len)))
				ASSERT(0);
			if (client_info = create_client_info(efd, accepted_fd)) {
				insert_client_info(client_info);
			}
			break;
		}
		case STATS_SERVER:
		{
			c_len = sizeof(c_addr);
			if (0 > (accepted_fd = accept(server->fd, (struct sockaddr *)&c_addr, &c_len)))
				ASSERT(0);
			if (client_info = create_client_info(efd, accepted_fd))
				client_info->server_flags |= STATS_CONN;
			break;
		}
		default:
		{
			if (!(server->server_flags & STATS_CONN) &&
			    NULL == server->session->server) {
				if (0 > attach_backend_lbserver(efd, server)) {
					close_client_pconn(server);
					lb_server->tot_unhandled_conn++;
				} else {
					lb_server->cur_conn++;
				}
			}
			ASSERT(server->session->buf_len <= BUF_LEN);
			int start, end;
{'fraction_non_alphanumeric': 0.14391691394658754, 'fraction_numerical': 0.0051928783382789315, 'mean_word_length': 3.8947368421052633, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, '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': '7354379', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1047, 'n_words': 199}