diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-09-04 15:16:58 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-09-04 15:16:58 +0000 |
commit | 3281308ec18b9a18ac2250a9f841a8906218f7ec (patch) | |
tree | 320a6d3a2c79160073c59f5efe63b3342c320c6f /src/microhttpd/test_upgrade_common.c | |
parent | 39bc8f5c76f844e56a04d5993ccfee9f2b41d17e (diff) | |
download | libmicrohttpd-3281308ec18b9a18ac2250a9f841a8906218f7ec.tar.gz libmicrohttpd-3281308ec18b9a18ac2250a9f841a8906218f7ec.zip |
also add tests for external select/epoll for connection upgrades
Diffstat (limited to 'src/microhttpd/test_upgrade_common.c')
-rw-r--r-- | src/microhttpd/test_upgrade_common.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/microhttpd/test_upgrade_common.c b/src/microhttpd/test_upgrade_common.c index 9985ef5e..c09ef4fd 100644 --- a/src/microhttpd/test_upgrade_common.c +++ b/src/microhttpd/test_upgrade_common.c | |||
@@ -413,7 +413,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon) | |||
413 | static void | 413 | static void |
414 | run_mhd_poll_loop (struct MHD_Daemon *daemon) | 414 | run_mhd_poll_loop (struct MHD_Daemon *daemon) |
415 | { | 415 | { |
416 | abort (); // not implemented | 416 | abort (); /* currently not implementable with existing MHD API */ |
417 | } | 417 | } |
418 | 418 | ||
419 | 419 | ||
@@ -426,7 +426,32 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon) | |||
426 | static void | 426 | static void |
427 | run_mhd_epoll_loop (struct MHD_Daemon *daemon) | 427 | run_mhd_epoll_loop (struct MHD_Daemon *daemon) |
428 | { | 428 | { |
429 | abort (); // not implemented | 429 | const union MHD_DaemonInfo *di; |
430 | MHD_socket ep; | ||
431 | fd_set rs; | ||
432 | MHD_UNSIGNED_LONG_LONG to; | ||
433 | struct timeval tv; | ||
434 | |||
435 | di = MHD_get_daemon_info (daemon, | ||
436 | MHD_DAEMON_INFO_EPOLL_FD); | ||
437 | ep = di->listen_fd; | ||
438 | while (! done) | ||
439 | { | ||
440 | FD_ZERO (&rs); | ||
441 | to = 1000; | ||
442 | |||
443 | FD_SET (ep, &rs); | ||
444 | MHD_get_timeout (daemon, | ||
445 | &to); | ||
446 | tv.tv_sec = to / 1000; | ||
447 | tv.tv_usec = 1000 * (to % 1000); | ||
448 | select (ep + 1, | ||
449 | &rs, | ||
450 | NULL, | ||
451 | NULL, | ||
452 | &tv); | ||
453 | MHD_run (daemon); | ||
454 | } | ||
430 | } | 455 | } |
431 | 456 | ||
432 | 457 | ||