Check-in [937df4b0c8]
Overview
Comment:More logging optimizations
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 937df4b0c88d0bd2d49c7ef754fa0154b3df2aea
User & Date: rkeene on 2014-02-18 05:16:35
Other Links: manifest | tags
Context
2014-02-18
05:18
Fixed potential (but unlikely) memory leaks related to logging check-in: f8df53b1e3 user: rkeene tags: trunk
05:16
More logging optimizations check-in: 937df4b0c8 user: rkeene tags: trunk
03:47
Added vhost support check-in: 3298334221 user: rkeene tags: trunk
Changes

Modified filed.c from [4157b8b146] to [865feafa0e].

1023
1024
1025
1026
1027
1028
1029










1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057

1058
1059

1060
1061
1062
1063
1064
1065
1066

	while (1) {
		/* Failure loop prevention */
		if (failure_count > max_failure_count) {
			break;
		}











		/* Accept a new client */
		addrlen = sizeof(addr);
		fd = accept(master_fd, (struct sockaddr *) &addr, &addrlen);

		/*
		 * If we fail, make a note of it so we don't go into a loop of
		 * accept() failing
		 */
		if (fd < 0) {
			/* Log the new connection */
			filed_log_msg("ACCEPT_FAILED");

			failure_count++;

			continue;
		}

		/* Log the new connection */
		log = filed_log_new(1);
		if (log == NULL) {
			close(fd);

			continue;
		}

		log->type = FILED_LOG_TYPE_TRANSFER;
		if (filed_log_ip((struct sockaddr *) &addr, log->ip, sizeof(log->ip)) == NULL) {
			log->ip[0] = '\0';

		}
		log->port = addr.sin6_port;


		/* Reset failure count*/
		failure_count = 0;

		/* Handle socket */
		filed_handle_client(fd, &request, log, options);
	}







>
>
>
>
>
>
>
>
>
>

















<
<
<
<
|
<
<
<
<


>
|
|
>







1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056




1057




1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070

	while (1) {
		/* Failure loop prevention */
		if (failure_count > max_failure_count) {
			break;
		}

		/* Allocate a new log buffer */
		log = filed_log_new(1);
		if (log == NULL) {
			filed_log_msg("ALLOCATE_LOG_MSG_FAILED");

			break;
		}

		log->type = FILED_LOG_TYPE_TRANSFER;

		/* Accept a new client */
		addrlen = sizeof(addr);
		fd = accept(master_fd, (struct sockaddr *) &addr, &addrlen);

		/*
		 * If we fail, make a note of it so we don't go into a loop of
		 * accept() failing
		 */
		if (fd < 0) {
			/* Log the new connection */
			filed_log_msg("ACCEPT_FAILED");

			failure_count++;

			continue;
		}





		/* Fill in log structure */




		if (filed_log_ip((struct sockaddr *) &addr, log->ip, sizeof(log->ip)) == NULL) {
			log->ip[0] = '\0';
			log->port = 0;
		} else {
			log->port = addr.sin6_port;
		}

		/* Reset failure count*/
		failure_count = 0;

		/* Handle socket */
		filed_handle_client(fd, &request, log, options);
	}