diff options
Diffstat (limited to 'src/examples/spdy_event_loop.c')
-rw-r--r-- | src/examples/spdy_event_loop.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/examples/spdy_event_loop.c b/src/examples/spdy_event_loop.c index 3b6f9c82..8d4bfa80 100644 --- a/src/examples/spdy_event_loop.c +++ b/src/examples/spdy_event_loop.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * PROGRAM | 22 | * PROGRAM |
23 | * @author Andrey Uzunov | 23 | * @author Andrey Uzunov |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include <unistd.h> | 27 | #include <unistd.h> |
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
@@ -55,6 +55,8 @@ static void | |||
55 | new_session_callback (void *cls, | 55 | new_session_callback (void *cls, |
56 | struct SPDY_Session * session) | 56 | struct SPDY_Session * session) |
57 | { | 57 | { |
58 | (void)cls; | ||
59 | |||
58 | char ipstr[1024]; | 60 | char ipstr[1024]; |
59 | 61 | ||
60 | struct sockaddr *addr; | 62 | struct sockaddr *addr; |
@@ -96,6 +98,9 @@ session_closed_handler (void *cls, | |||
96 | struct SPDY_Session * session, | 98 | struct SPDY_Session * session, |
97 | int by_client) | 99 | int by_client) |
98 | { | 100 | { |
101 | (void)cls; | ||
102 | (void)session; | ||
103 | |||
99 | //printf("session_closed_handler called\n"); | 104 | //printf("session_closed_handler called\n"); |
100 | 105 | ||
101 | if(SPDY_YES != by_client) | 106 | if(SPDY_YES != by_client) |
@@ -139,7 +144,7 @@ response_done_callback(void *cls, | |||
139 | free(cls); | 144 | free(cls); |
140 | } | 145 | } |
141 | 146 | ||
142 | 147 | /* | |
143 | static int | 148 | static int |
144 | print_headers (void *cls, | 149 | print_headers (void *cls, |
145 | const char *name, const char *value) | 150 | const char *name, const char *value) |
@@ -148,6 +153,8 @@ print_headers (void *cls, | |||
148 | printf("%s: %s\n",name,value); | 153 | printf("%s: %s\n",name,value); |
149 | return SPDY_YES; | 154 | return SPDY_YES; |
150 | } | 155 | } |
156 | */ | ||
157 | |||
151 | 158 | ||
152 | /* | 159 | /* |
153 | void | 160 | void |
@@ -202,6 +209,8 @@ standard_request_handler(void *cls, | |||
202 | struct SPDY_NameValue * headers, | 209 | struct SPDY_NameValue * headers, |
203 | bool more) | 210 | bool more) |
204 | { | 211 | { |
212 | (void)more; | ||
213 | |||
205 | char *html; | 214 | char *html; |
206 | char *data; | 215 | char *data; |
207 | struct SPDY_Response *response=NULL; | 216 | struct SPDY_Response *response=NULL; |
@@ -267,6 +276,10 @@ new_post_data_cb (void * cls, | |||
267 | size_t size, | 276 | size_t size, |
268 | bool more) | 277 | bool more) |
269 | { | 278 | { |
279 | (void)cls; | ||
280 | (void)request; | ||
281 | (void)more; | ||
282 | |||
270 | printf("DATA:\n===============================\n"); | 283 | printf("DATA:\n===============================\n"); |
271 | write(0, buf, size); | 284 | write(0, buf, size); |
272 | printf("\n===============================\n"); | 285 | printf("\n===============================\n"); |
@@ -277,7 +290,9 @@ new_post_data_cb (void * cls, | |||
277 | static void | 290 | static void |
278 | sig_handler(int signo) | 291 | sig_handler(int signo) |
279 | { | 292 | { |
280 | printf("received signal\n"); | 293 | (void)signo; |
294 | |||
295 | printf("received signal\n"); | ||
281 | } | 296 | } |
282 | 297 | ||
283 | 298 | ||
@@ -293,13 +308,15 @@ main (int argc, char *const *argv) | |||
293 | 308 | ||
294 | SPDY_init(); | 309 | SPDY_init(); |
295 | 310 | ||
296 | struct sockaddr_in addr4; | 311 | /* |
312 | struct sockaddr_in addr4; | ||
297 | struct in_addr inaddr4; | 313 | struct in_addr inaddr4; |
298 | inaddr4.s_addr = htonl(INADDR_ANY); | 314 | inaddr4.s_addr = htonl(INADDR_ANY); |
299 | addr4.sin_family = AF_INET; | 315 | addr4.sin_family = AF_INET; |
300 | addr4.sin_addr = inaddr4; | 316 | addr4.sin_addr = inaddr4; |
301 | addr4.sin_port = htons(atoi(argv[1])); | 317 | addr4.sin_port = htons(atoi(argv[1])); |
302 | 318 | */ | |
319 | |||
303 | struct SPDY_Daemon *daemon = SPDY_start_daemon(atoi(argv[1]), | 320 | struct SPDY_Daemon *daemon = SPDY_start_daemon(atoi(argv[1]), |
304 | DATA_DIR "cert-and-key.pem", | 321 | DATA_DIR "cert-and-key.pem", |
305 | DATA_DIR "cert-and-key.pem", | 322 | DATA_DIR "cert-and-key.pem", |
@@ -313,11 +330,13 @@ main (int argc, char *const *argv) | |||
313 | return 1; | 330 | return 1; |
314 | } | 331 | } |
315 | 332 | ||
333 | /* | ||
316 | struct sockaddr_in6 addr6; | 334 | struct sockaddr_in6 addr6; |
317 | addr6.sin6_family = AF_INET6; | 335 | addr6.sin6_family = AF_INET6; |
318 | addr6.sin6_addr = in6addr_any; | 336 | addr6.sin6_addr = in6addr_any; |
319 | addr6.sin6_port = htons(atoi(argv[1]) + 1); | 337 | addr6.sin6_port = htons(atoi(argv[1]) + 1); |
320 | 338 | */ | |
339 | |||
321 | struct SPDY_Daemon *daemon2 = SPDY_start_daemon(atoi(argv[1]) + 1, | 340 | struct SPDY_Daemon *daemon2 = SPDY_start_daemon(atoi(argv[1]) + 1, |
322 | DATA_DIR "cert-and-key.pem", | 341 | DATA_DIR "cert-and-key.pem", |
323 | DATA_DIR "cert-and-key.pem", | 342 | DATA_DIR "cert-and-key.pem", |
@@ -363,7 +382,7 @@ main (int argc, char *const *argv) | |||
363 | timeout.tv_usec = (timeoutlong % 1000) * 1000; | 382 | timeout.tv_usec = (timeoutlong % 1000) * 1000; |
364 | } | 383 | } |
365 | 384 | ||
366 | printf("ret=%i; timeoutlong=%i; sec=%i; usec=%i\n", ret, timeoutlong, timeout.tv_sec, timeout.tv_usec); | 385 | printf("ret=%i; timeoutlong=%llu; sec=%llu; usec=%llu\n", ret, timeoutlong, (long long unsigned)timeout.tv_sec, (long long unsigned)timeout.tv_usec); |
367 | //raise(SIGINT); | 386 | //raise(SIGINT); |
368 | 387 | ||
369 | /* get file descriptors from the transfers */ | 388 | /* get file descriptors from the transfers */ |
@@ -395,7 +414,7 @@ main (int argc, char *const *argv) | |||
395 | } | 414 | } |
396 | else if(daemon != NULL){ | 415 | else if(daemon != NULL){ |
397 | 416 | ||
398 | printf("%i loops in %i secs\n", loops, time(NULL) - start); | 417 | printf("%lu loops in %llu secs\n", loops, (long long unsigned)(time(NULL) - start)); |
399 | SPDY_stop_daemon(daemon); | 418 | SPDY_stop_daemon(daemon); |
400 | daemon=NULL; | 419 | daemon=NULL; |
401 | } | 420 | } |