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   1023   
  1024   1024   	while (1) {
  1025   1025   		/* Failure loop prevention */
  1026   1026   		if (failure_count > max_failure_count) {
  1027   1027   			break;
  1028   1028   		}
  1029   1029   
         1030  +		/* Allocate a new log buffer */
         1031  +		log = filed_log_new(1);
         1032  +		if (log == NULL) {
         1033  +			filed_log_msg("ALLOCATE_LOG_MSG_FAILED");
         1034  +
         1035  +			break;
         1036  +		}
         1037  +
         1038  +		log->type = FILED_LOG_TYPE_TRANSFER;
         1039  +
  1030   1040   		/* Accept a new client */
  1031   1041   		addrlen = sizeof(addr);
  1032   1042   		fd = accept(master_fd, (struct sockaddr *) &addr, &addrlen);
  1033   1043   
  1034   1044   		/*
  1035   1045   		 * If we fail, make a note of it so we don't go into a loop of
  1036   1046   		 * accept() failing
................................................................................
  1040   1050   			filed_log_msg("ACCEPT_FAILED");
  1041   1051   
  1042   1052   			failure_count++;
  1043   1053   
  1044   1054   			continue;
  1045   1055   		}
  1046   1056   
  1047         -		/* Log the new connection */
  1048         -		log = filed_log_new(1);
  1049         -		if (log == NULL) {
  1050         -			close(fd);
  1051         -
  1052         -			continue;
  1053         -		}
  1054         -
  1055         -		log->type = FILED_LOG_TYPE_TRANSFER;
         1057  +		/* Fill in log structure */
  1056   1058   		if (filed_log_ip((struct sockaddr *) &addr, log->ip, sizeof(log->ip)) == NULL) {
  1057   1059   			log->ip[0] = '\0';
  1058         -		}
         1060  +			log->port = 0;
         1061  +		} else {
  1059   1062   		log->port = addr.sin6_port;
         1063  +		}
  1060   1064   
  1061   1065   		/* Reset failure count*/
  1062   1066   		failure_count = 0;
  1063   1067   
  1064   1068   		/* Handle socket */
  1065   1069   		filed_handle_client(fd, &request, log, options);
  1066   1070   	}