Overview
Comment: | Updated to cache file descriptors |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
565d4b51c2cd0fa96ef28afea971a0e5 |
User & Date: | rkeene on 2014-02-05 08:49:33 |
Other Links: | manifest | tags |
Context
2014-02-05
| ||
09:01 | Added support for a "no logging" compile-time option (for now) and updated to support sendfile restarts check-in: c7e703e4e5 user: rkeene tags: trunk | |
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 | |
Changes
Modified filed.c from [8a849d733e] to [af10919239].
︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + | /* Arguments for worker threads */ struct filed_worker_thread_args { int fd; }; /* File information */ struct filed_fileinfo { pthread_mutex_t mutex; char *path; int fd; size_t len; char *lastmod; char lastmod_b[64]; char *type; }; /* Global variables */ struct filed_fileinfo *filed_fileinfo_fdcache; unsigned int filed_fileinfo_fdcache_size = 8192; /* Initialize process */ |
︙ | |||
77 78 79 80 81 82 83 84 85 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + | /* Initialize logging thread */ static int filed_logging_thread_init(void) { /* XXX:TODO: Unimplemented */ return(0); } /* Log a message */ #define filed_log_msg_debug(x, ...) { fprintf(stderr, x, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); } static void filed_log_msg(const char *buffer) { /* XXX:TODO: Unimplemented */ fprintf(stderr, "%s\n", buffer); |
︙ | |||
194 195 196 197 198 199 200 201 202 203 204 205 206 207 | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | + | ); } /* Handle a single request from a client */ static void filed_handle_client(int fd) { struct filed_fileinfo *fileinfo, fileinfo_b; ssize_t sendfile_ret; off_t sendfile_offset; 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)); |
︙ | |||
241 242 243 244 245 246 247 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | + - + | ); fflush(fp); filed_log_msg("PROCESS_REPLY_COMPLETE FD=... STATUS=200"); filed_log_msg("SEND_START IFD=... OFD=... BYTES=..."); sendfile_offset = 0; |
︙ | |||
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | + - + + + + + + | return(0); } /* Run process */ int main(int argc, char **argv) { int port = PORT, thread_count = THREAD_COUNT; const char *bind_addr = BIND_ADDR; int init_ret; int fd; /* Ignore */ argc = argc; argv = argv; /* Create listening socket */ fd = filed_listen(bind_addr, port); if (fd < 0) { perror("filed_listen"); return(1); } /* Become a daemon */ /* XXX:TODO: Become a daemon */ /* Initialize */ |
︙ |