diff options
Diffstat (limited to 'src/testcurl/test_quiesce_stream.c')
-rw-r--r-- | src/testcurl/test_quiesce_stream.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/testcurl/test_quiesce_stream.c b/src/testcurl/test_quiesce_stream.c index f20ebcac..c9336f2c 100644 --- a/src/testcurl/test_quiesce_stream.c +++ b/src/testcurl/test_quiesce_stream.c | |||
@@ -73,13 +73,14 @@ static void | |||
73 | suspend_connection (struct MHD_Connection *connection) | 73 | suspend_connection (struct MHD_Connection *connection) |
74 | { | 74 | { |
75 | pthread_t thread_id; | 75 | pthread_t thread_id; |
76 | int status; | ||
76 | 77 | ||
77 | /* fprintf (stderr, "Calling suspend\n"); */ | 78 | /* fprintf (stderr, "Calling suspend\n"); */ |
78 | MHD_suspend_connection (connection); | 79 | MHD_suspend_connection (connection); |
79 | int status = pthread_create (&thread_id, | 80 | status = pthread_create (&thread_id, |
80 | NULL, | 81 | NULL, |
81 | &resume_connection, | 82 | &resume_connection, |
82 | connection); | 83 | connection); |
83 | if (0 != status) | 84 | if (0 != status) |
84 | { | 85 | { |
85 | fprintf (stderr, | 86 | fprintf (stderr, |
@@ -143,6 +144,7 @@ http_AccessHandlerCallback (void *cls, | |||
143 | void **con_cls) | 144 | void **con_cls) |
144 | { | 145 | { |
145 | enum MHD_Result ret; | 146 | enum MHD_Result ret; |
147 | struct MHD_Response *response; | ||
146 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ | 148 | (void) cls; (void) url; /* Unused. Silent compiler warning. */ |
147 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ | 149 | (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ |
148 | (void) upload_data_size; /* Unused. Silent compiler warning. */ | 150 | (void) upload_data_size; /* Unused. Silent compiler warning. */ |
@@ -150,12 +152,12 @@ http_AccessHandlerCallback (void *cls, | |||
150 | /* Never respond on first call */ | 152 | /* Never respond on first call */ |
151 | if (NULL == *con_cls) | 153 | if (NULL == *con_cls) |
152 | { | 154 | { |
155 | struct ContentReaderUserdata *userdata; | ||
153 | fprintf (stderr, | 156 | fprintf (stderr, |
154 | "start: %d\n", | 157 | "start: %d\n", |
155 | ++request_counter); | 158 | ++request_counter); |
156 | 159 | ||
157 | struct ContentReaderUserdata *userdata = malloc (sizeof(struct | 160 | userdata = malloc (sizeof(struct ContentReaderUserdata)); |
158 | ContentReaderUserdata)); | ||
159 | 161 | ||
160 | if (NULL == userdata) | 162 | if (NULL == userdata) |
161 | return MHD_NO; | 163 | return MHD_NO; |
@@ -166,7 +168,7 @@ http_AccessHandlerCallback (void *cls, | |||
166 | } | 168 | } |
167 | 169 | ||
168 | /* Second call: create response */ | 170 | /* Second call: create response */ |
169 | struct MHD_Response *response | 171 | response |
170 | = MHD_create_response_from_callback (-1, | 172 | = MHD_create_response_from_callback (-1, |
171 | 32 * 1024, | 173 | 32 * 1024, |
172 | &http_ContentReaderCallback, | 174 | &http_ContentReaderCallback, |
@@ -187,6 +189,13 @@ main (void) | |||
187 | { | 189 | { |
188 | int port; | 190 | int port; |
189 | char command_line[1024]; | 191 | char command_line[1024]; |
192 | /* Flags */ | ||
193 | unsigned int daemon_flags | ||
194 | = MHD_USE_INTERNAL_POLLING_THREAD | ||
195 | | MHD_USE_AUTO | ||
196 | | MHD_ALLOW_SUSPEND_RESUME | ||
197 | | MHD_USE_ITC; | ||
198 | struct MHD_Daemon *daemon; | ||
190 | 199 | ||
191 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) | 200 | if (MHD_NO != MHD_is_feature_supported (MHD_FEATURE_AUTODETECT_BIND_PORT)) |
192 | port = 0; | 201 | port = 0; |
@@ -197,21 +206,15 @@ main (void) | |||
197 | MHD_set_panic_func (&http_PanicCallback, | 206 | MHD_set_panic_func (&http_PanicCallback, |
198 | NULL); | 207 | NULL); |
199 | 208 | ||
200 | /* Flags */ | ||
201 | unsigned int daemon_flags | ||
202 | = MHD_USE_INTERNAL_POLLING_THREAD | ||
203 | | MHD_USE_AUTO | ||
204 | | MHD_ALLOW_SUSPEND_RESUME | ||
205 | | MHD_USE_ITC; | ||
206 | 209 | ||
207 | /* Create daemon */ | 210 | /* Create daemon */ |
208 | struct MHD_Daemon *daemon = MHD_start_daemon (daemon_flags, | 211 | daemon = MHD_start_daemon (daemon_flags, |
209 | port, | 212 | port, |
210 | NULL, | 213 | NULL, |
211 | NULL, | 214 | NULL, |
212 | &http_AccessHandlerCallback, | 215 | &http_AccessHandlerCallback, |
213 | NULL, | 216 | NULL, |
214 | MHD_OPTION_END); | 217 | MHD_OPTION_END); |
215 | if (NULL == daemon) | 218 | if (NULL == daemon) |
216 | return 1; | 219 | return 1; |
217 | if (0 == port) | 220 | if (0 == port) |