aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_upgrade_large.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/test_upgrade_large.c')
-rw-r--r--src/microhttpd/test_upgrade_large.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c
index 43c04b7f..a4d339ad 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -48,6 +48,7 @@
48 48
49#include "platform.h" 49#include "platform.h"
50#include "microhttpd.h" 50#include "microhttpd.h"
51#include "mhd_itc.h"
51 52
52#include "test_helpers.h" 53#include "test_helpers.h"
53 54
@@ -69,7 +70,7 @@
69 70
70static int verbose = 0; 71static int verbose = 0;
71 72
72static int kicker[2] = {-1, -1}; 73static struct MHD_itc_ kicker = MHD_ITC_STATIC_INIT_INVALID;
73 74
74enum tls_tool 75enum tls_tool
75{ 76{
@@ -588,9 +589,9 @@ make_blocking (MHD_socket fd)
588static void 589static void
589kick_select () 590kick_select ()
590{ 591{
591 if (-1 != kicker[1]) 592 if (MHD_ITC_IS_VALID_(kicker))
592 { 593 {
593 (void) write (kicker[1], "K", 1); 594 MHD_itc_activate_ (kicker, "K");
594 } 595 }
595} 596}
596 597
@@ -917,9 +918,8 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
917 MHD_socket max_fd; 918 MHD_socket max_fd;
918 MHD_UNSIGNED_LONG_LONG to; 919 MHD_UNSIGNED_LONG_LONG to;
919 struct timeval tv; 920 struct timeval tv;
920 char drain[128];
921 921
922 if (0 != pipe (kicker)) 922 if (!MHD_itc_init_ (kicker))
923 abort (); 923 abort ();
924 while (! done) 924 while (! done)
925 { 925 {
@@ -929,7 +929,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
929 max_fd = -1; 929 max_fd = -1;
930 to = 1000; 930 to = 1000;
931 931
932 FD_SET (kicker[0], &rs); 932 FD_SET (MHD_itc_r_fd_ (kicker), &rs);
933 if (MHD_YES != 933 if (MHD_YES !=
934 MHD_get_fdset (daemon, 934 MHD_get_fdset (daemon,
935 &rs, 935 &rs,
@@ -949,17 +949,15 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
949 &es, 949 &es,
950 &tv)) 950 &tv))
951 abort (); 951 abort ();
952 if (FD_ISSET (kicker[0], &rs)) 952 if (FD_ISSET (MHD_itc_r_fd_ (kicker), &rs))
953 (void) read (kicker[0], drain, sizeof (drain)); 953 MHD_itc_clear_ (kicker);
954 MHD_run_from_select (daemon, 954 MHD_run_from_select (daemon,
955 &rs, 955 &rs,
956 &ws, 956 &ws,
957 &es); 957 &es);
958 } 958 }
959 close (kicker[0]); 959 MHD_itc_destroy_ (kicker);
960 close (kicker[1]); 960 MHD_itc_set_invalid_ (kicker);
961 kicker[0] = -1;
962 kicker[1] = -1;
963} 961}
964 962
965 963
@@ -1001,13 +999,13 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
1001 di = MHD_get_daemon_info (daemon, 999 di = MHD_get_daemon_info (daemon,
1002 MHD_DAEMON_INFO_EPOLL_FD); 1000 MHD_DAEMON_INFO_EPOLL_FD);
1003 ep = di->listen_fd; 1001 ep = di->listen_fd;
1004 if (0 != pipe (kicker)) 1002 if (!MHD_itc_init_ (kicker))
1005 abort (); 1003 abort ();
1006 while (! done) 1004 while (! done)
1007 { 1005 {
1008 FD_ZERO (&rs); 1006 FD_ZERO (&rs);
1009 to = 1000; 1007 to = 1000;
1010 FD_SET (kicker[0], &rs); 1008 FD_SET (MHD_itc_r_fd_ (kicker), &rs);
1011 FD_SET (ep, &rs); 1009 FD_SET (ep, &rs);
1012 (void) MHD_get_timeout (daemon, 1010 (void) MHD_get_timeout (daemon,
1013 &to); 1011 &to);
@@ -1024,14 +1022,12 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
1024 (EAGAIN != errno) && 1022 (EAGAIN != errno) &&
1025 (EINTR != errno) ) 1023 (EINTR != errno) )
1026 abort (); 1024 abort ();
1027 if (FD_ISSET (kicker[0], &rs)) 1025 if (FD_ISSET (MHD_itc_r_fd_ (kicker), &rs))
1028 (void) read (kicker[0], drain, sizeof (drain)); 1026 MHD_itc_clear_ (kicker);
1029 MHD_run (daemon); 1027 MHD_run (daemon);
1030 } 1028 }
1031 close (kicker[0]); 1029 MHD_itc_destroy_ (kicker);
1032 close (kicker[1]); 1030 MHD_itc_set_invalid_ (kicker);
1033 kicker[0] = -1;
1034 kicker[1] = -1;
1035} 1031}
1036 1032
1037 1033