aboutsummaryrefslogtreecommitdiff
path: root/src/examples/websocket_threaded_example.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/websocket_threaded_example.c')
-rw-r--r--src/examples/websocket_threaded_example.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c
index 69abb0f3..2310b82b 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -402,7 +402,7 @@ BASE64Encode (const void *in, size_t len, unsigned char **output)
402 402
403/********** end Base64 **********/ 403/********** end Base64 **********/
404 404
405static int 405static enum MHD_Result
406is_websocket_request (struct MHD_Connection *con, const char *upg_header, 406is_websocket_request (struct MHD_Connection *con, const char *upg_header,
407 const char *con_header) 407 const char *con_header)
408{ 408{
@@ -414,11 +414,11 @@ is_websocket_request (struct MHD_Connection *con, const char *upg_header,
414} 414}
415 415
416 416
417static int 417static enum MHD_Result
418send_chat_page (struct MHD_Connection *con, uint16_t port) 418send_chat_page (struct MHD_Connection *con, uint16_t port)
419{ 419{
420 struct MHD_Response *res; 420 struct MHD_Response *res;
421 int ret; 421 enum MHD_Result ret;
422 res = MHD_create_response_from_buffer (strlen (CHAT_PAGE), (void *) CHAT_PAGE, 422 res = MHD_create_response_from_buffer (strlen (CHAT_PAGE), (void *) CHAT_PAGE,
423 MHD_RESPMEM_PERSISTENT); 423 MHD_RESPMEM_PERSISTENT);
424 ret = MHD_queue_response (con, MHD_HTTP_OK, res); 424 ret = MHD_queue_response (con, MHD_HTTP_OK, res);
@@ -427,11 +427,11 @@ send_chat_page (struct MHD_Connection *con, uint16_t port)
427} 427}
428 428
429 429
430static int 430static enum MHD_Result
431send_bad_request (struct MHD_Connection *con) 431send_bad_request (struct MHD_Connection *con)
432{ 432{
433 struct MHD_Response *res; 433 struct MHD_Response *res;
434 int ret; 434 enum MHD_Result ret;
435 res = MHD_create_response_from_buffer (strlen (BAD_REQUEST_PAGE), 435 res = MHD_create_response_from_buffer (strlen (BAD_REQUEST_PAGE),
436 (void *) BAD_REQUEST_PAGE, 436 (void *) BAD_REQUEST_PAGE,
437 MHD_RESPMEM_PERSISTENT); 437 MHD_RESPMEM_PERSISTENT);
@@ -441,11 +441,11 @@ send_bad_request (struct MHD_Connection *con)
441} 441}
442 442
443 443
444static int 444static enum MHD_Result
445send_upgrade_required (struct MHD_Connection *con) 445send_upgrade_required (struct MHD_Connection *con)
446{ 446{
447 struct MHD_Response *res; 447 struct MHD_Response *res;
448 int ret; 448 enum MHD_Result ret;
449 res = MHD_create_response_from_buffer (strlen (UPGRADE_REQUIRED_PAGE), 449 res = MHD_create_response_from_buffer (strlen (UPGRADE_REQUIRED_PAGE),
450 (void *) UPGRADE_REQUIRED_PAGE, 450 (void *) UPGRADE_REQUIRED_PAGE,
451 MHD_RESPMEM_PERSISTENT); 451 MHD_RESPMEM_PERSISTENT);
@@ -457,7 +457,7 @@ send_upgrade_required (struct MHD_Connection *con)
457} 457}
458 458
459 459
460static int 460static enum MHD_Result
461ws_get_accept_value (char *key, unsigned char **val) 461ws_get_accept_value (char *key, unsigned char **val)
462{ 462{
463 struct SHA1Context ctx; 463 struct SHA1Context ctx;
@@ -731,7 +731,7 @@ run_usock (void *cls)
731} 731}
732 732
733 733
734static int 734static enum MHD_Result
735uh_cb (void *cls, struct MHD_Connection *con, void *con_cls, 735uh_cb (void *cls, struct MHD_Connection *con, void *con_cls,
736 const char *extra_in, size_t extra_in_size, MHD_socket sock, 736 const char *extra_in, size_t extra_in_size, MHD_socket sock,
737 struct MHD_UpgradeResponseHandle *urh) 737 struct MHD_UpgradeResponseHandle *urh)
@@ -764,7 +764,7 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls,
764 { 764 {
765 free (ws); 765 free (ws);
766 MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE); 766 MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE);
767 return; 767 return MHD_YES;
768 } 768 }
769 pthread_mutex_unlock (&MUTEX); 769 pthread_mutex_unlock (&MUTEX);
770 if (0 != pthread_create (&pt, NULL, &run_usock, ws)) 770 if (0 != pthread_create (&pt, NULL, &run_usock, ws))
@@ -773,10 +773,11 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls,
773 a clean shutdown, as the we stop the daemon even if a worker thread 773 a clean shutdown, as the we stop the daemon even if a worker thread
774 is still running. Alas, this is a simple example... */ 774 is still running. Alas, this is a simple example... */
775 pthread_detach (pt); 775 pthread_detach (pt);
776 return MHD_YES;
776} 777}
777 778
778 779
779static int 780static enum MHD_Result
780ahc_cb (void *cls, struct MHD_Connection *con, const char *url, 781ahc_cb (void *cls, struct MHD_Connection *con, const char *url,
781 const char *method, const char *version, const char *upload_data, 782 const char *method, const char *version, const char *upload_data,
782 size_t *upload_data_size, void **ptr) 783 size_t *upload_data_size, void **ptr)
@@ -788,7 +789,7 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char *url,
788 const char *ws_key_header; 789 const char *ws_key_header;
789 char ws_ac_header[60]; 790 char ws_ac_header[60];
790 char *ws_ac_value; 791 char *ws_ac_value;
791 int ret; 792 enum MHD_Result ret;
792 (void) url; 793 (void) url;
793 (void) upload_data; 794 (void) upload_data;
794 (void) upload_data_size; 795 (void) upload_data_size;