Check-in [16b1aecd99]
Overview
Comment:Check sendfile() output and log
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 16b1aecd995523566eda0f087a187c580db203e1
User & Date: rkeene on 2014-02-04 12:02:48
Other Links: manifest | tags
Context
2014-02-05
08:49
Updated to cache file descriptors check-in: 565d4b51c2 user: rkeene tags: trunk
2014-02-04
12:02
Check sendfile() output and log check-in: 16b1aecd99 user: rkeene tags: trunk
11:51
Added more log messages and support for error pages check-in: 70ecb45a61 user: rkeene tags: trunk
Changes

Modified filed.c from [456b09599d] to [8a849d733e].

193
194
195
196
197
198
199

200
201
202
203
204
205
206
		error_string
	);
}

/* Handle a single request from a client */
static void filed_handle_client(int fd) {
	struct filed_fileinfo *fileinfo, fileinfo_b;

	char *path, path_b[1010];
	char *date_current, date_current_b[64];
	FILE *fp;

	/* Determine current time */
	date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));








>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
		error_string
	);
}

/* Handle a single request from a client */
static void filed_handle_client(int fd) {
	struct filed_fileinfo *fileinfo, fileinfo_b;
	ssize_t sendfile_ret;
	char *path, path_b[1010];
	char *date_current, date_current_b[64];
	FILE *fp;

	/* Determine current time */
	date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));

240
241
242
243
244
245
246
247




248
249
250
251
252
253
254
255
256
		);
		fflush(fp);

		filed_log_msg("PROCESS_REPLY_COMPLETE FD=... STATUS=200");

		filed_log_msg("SEND_START IFD=... OFD=... BYTES=...");

		sendfile(fd, fileinfo->fd, NULL, fileinfo->len);





		filed_log_msg("SEND_COMPLETE IFD=... OFD=... BYTES=...");

		close(fileinfo->fd);

		filed_log_msg("CLOSE_FILE FD=...");
	}

	filed_log_msg("CLOSE_CONNECTION FD=...");







|
>
>
>
>
|
<







241
242
243
244
245
246
247
248
249
250
251
252
253

254
255
256
257
258
259
260
		);
		fflush(fp);

		filed_log_msg("PROCESS_REPLY_COMPLETE FD=... STATUS=200");

		filed_log_msg("SEND_START IFD=... OFD=... BYTES=...");

		sendfile_ret = sendfile(fd, fileinfo->fd, NULL, fileinfo->len);
		if (sendfile_ret < 0 || ((size_t) sendfile_ret) != fileinfo->len) {
			filed_log_msg("SEND_COMPLETE STATUS=ERROR IFD=... OFD=... BYTES=... BYTES_SENT=...");
		} else {
			filed_log_msg("SEND_COMPLETE STATUS=OK IFD=... OFD=... BYTES=...");
		}


		close(fileinfo->fd);

		filed_log_msg("CLOSE_FILE FD=...");
	}

	filed_log_msg("CLOSE_CONNECTION FD=...");