diff options
author | Andrey Uzunov <andrey.uzunov@gmail.com> | 2013-07-17 14:46:49 +0000 |
---|---|---|
committer | Andrey Uzunov <andrey.uzunov@gmail.com> | 2013-07-17 14:46:49 +0000 |
commit | b43954303929b9e3980805d51322db9f9046e7c4 (patch) | |
tree | 8e3c7ed8ff9b0f50afaf02bd5e566e6c1e50b739 /src/examples | |
parent | 4231889ce35dd86cbd6a3872b3fcba053f1fd65c (diff) | |
download | libmicrohttpd-b43954303929b9e3980805d51322db9f9046e7c4.tar.gz libmicrohttpd-b43954303929b9e3980805d51322db9f9046e7c4.zip |
spdy: change SPDY_get_timeout to give not seconds but milliseconds as it used to be
Diffstat (limited to 'src/examples')
-rw-r--r-- | src/examples/spdy_event_loop.c | 17 | ||||
-rw-r--r-- | src/examples/spdy_fileserver.c | 13 | ||||
-rw-r--r-- | src/examples/spdy_response_with_callback.c | 14 |
3 files changed, 16 insertions, 28 deletions
diff --git a/src/examples/spdy_event_loop.c b/src/examples/spdy_event_loop.c index a716028f..e5e2a5b1 100644 --- a/src/examples/spdy_event_loop.c +++ b/src/examples/spdy_event_loop.c | |||
@@ -337,22 +337,17 @@ main (int argc, char *const *argv) | |||
337 | FD_ZERO(&except_fd_set); | 337 | FD_ZERO(&except_fd_set); |
338 | 338 | ||
339 | ret = SPDY_get_timeout(daemon, &timeoutlong); | 339 | ret = SPDY_get_timeout(daemon, &timeoutlong); |
340 | //printf("tout %i\n",timeoutlong); | 340 | if(SPDY_NO == ret || timeoutlong > 1000) |
341 | if(SPDY_NO == ret || timeoutlong > 1) | 341 | { |
342 | { | ||
343 | //do sth else | ||
344 | //sleep(1); | ||
345 | |||
346 | //try new connection | ||
347 | timeout.tv_sec = 1; | 342 | timeout.tv_sec = 1; |
348 | timeout.tv_usec = 0; | 343 | timeout.tv_usec = 0; |
349 | } | 344 | } |
350 | else | 345 | else |
351 | { | 346 | { |
352 | timeout.tv_sec = timeoutlong; | 347 | timeout.tv_sec = timeoutlong / 1000; |
353 | timeout.tv_usec = 0;//(timeoutlong % 1000) * 1000; | 348 | timeout.tv_usec = (timeoutlong % 1000) * 1000; |
354 | } | 349 | } |
355 | 350 | ||
356 | printf("ret=%i; timeoutlong=%i; sec=%i; usec=%i\n", ret, timeoutlong, timeout.tv_sec, timeout.tv_usec); | 351 | printf("ret=%i; timeoutlong=%i; sec=%i; usec=%i\n", ret, timeoutlong, timeout.tv_sec, timeout.tv_usec); |
357 | //raise(SIGINT); | 352 | //raise(SIGINT); |
358 | 353 | ||
diff --git a/src/examples/spdy_fileserver.c b/src/examples/spdy_fileserver.c index eea0930e..f2b8f7b0 100644 --- a/src/examples/spdy_fileserver.c +++ b/src/examples/spdy_fileserver.c | |||
@@ -287,7 +287,6 @@ main (int argc, char *const *argv) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | basedir = argv[3]; | 289 | basedir = argv[3]; |
290 | timeout.tv_usec = 0; | ||
291 | 290 | ||
292 | do | 291 | do |
293 | { | 292 | { |
@@ -296,17 +295,15 @@ main (int argc, char *const *argv) | |||
296 | FD_ZERO(&except_fd_set); | 295 | FD_ZERO(&except_fd_set); |
297 | 296 | ||
298 | ret = SPDY_get_timeout(daemon, &timeoutlong); | 297 | ret = SPDY_get_timeout(daemon, &timeoutlong); |
299 | if(SPDY_NO == ret || timeoutlong > 1) | 298 | if(SPDY_NO == ret || timeoutlong > 1000) |
300 | { | 299 | { |
301 | //do sth else | ||
302 | //sleep(1); | ||
303 | |||
304 | //try new connection | ||
305 | timeout.tv_sec = 1; | 300 | timeout.tv_sec = 1; |
301 | timeout.tv_usec = 0; | ||
306 | } | 302 | } |
307 | else | 303 | else |
308 | { | 304 | { |
309 | timeout.tv_sec = timeoutlong; | 305 | timeout.tv_sec = timeoutlong / 1000; |
306 | timeout.tv_usec = (timeoutlong % 1000) * 1000; | ||
310 | } | 307 | } |
311 | 308 | ||
312 | maxfd = SPDY_get_fdset (daemon, | 309 | maxfd = SPDY_get_fdset (daemon, |
diff --git a/src/examples/spdy_response_with_callback.c b/src/examples/spdy_response_with_callback.c index 21085c78..1a029a64 100644 --- a/src/examples/spdy_response_with_callback.c +++ b/src/examples/spdy_response_with_callback.c | |||
@@ -180,8 +180,6 @@ main (int argc, char *const *argv) | |||
180 | return 1; | 180 | return 1; |
181 | } | 181 | } |
182 | 182 | ||
183 | timeout.tv_usec = 0; | ||
184 | |||
185 | do | 183 | do |
186 | { | 184 | { |
187 | FD_ZERO(&read_fd_set); | 185 | FD_ZERO(&read_fd_set); |
@@ -189,17 +187,15 @@ main (int argc, char *const *argv) | |||
189 | FD_ZERO(&except_fd_set); | 187 | FD_ZERO(&except_fd_set); |
190 | 188 | ||
191 | ret = SPDY_get_timeout(daemon, &timeoutlong); | 189 | ret = SPDY_get_timeout(daemon, &timeoutlong); |
192 | if(SPDY_NO == ret || timeoutlong > 1) | 190 | if(SPDY_NO == ret || timeoutlong > 1000) |
193 | { | 191 | { |
194 | //do sth else | ||
195 | //sleep(1); | ||
196 | |||
197 | //try new connection | ||
198 | timeout.tv_sec = 1; | 192 | timeout.tv_sec = 1; |
193 | timeout.tv_usec = 0; | ||
199 | } | 194 | } |
200 | else | 195 | else |
201 | { | 196 | { |
202 | timeout.tv_sec = timeoutlong; | 197 | timeout.tv_sec = timeoutlong / 1000; |
198 | timeout.tv_usec = (timeoutlong % 1000) * 1000; | ||
203 | } | 199 | } |
204 | 200 | ||
205 | maxfd = SPDY_get_fdset (daemon, | 201 | maxfd = SPDY_get_fdset (daemon, |