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.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c
index 4fcac79b..eec1f557 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -625,7 +625,8 @@ ws_send_frame (MHD_socket sock, const char *msg, size_t length)
625 } 625 }
626 response[idx_response] = '\0'; 626 response[idx_response] = '\0';
627 output = 0; 627 output = 0;
628 pthread_mutex_lock (&MUTEX); 628 if (0 != pthread_mutex_lock (&MUTEX))
629 abort ();
629 for (i = 0; i < MAX_CLIENTS; i++) 630 for (i = 0; i < MAX_CLIENTS; i++)
630 { 631 {
631 isock = CLIENT_SOCKS[i]; 632 isock = CLIENT_SOCKS[i];
@@ -634,7 +635,8 @@ ws_send_frame (MHD_socket sock, const char *msg, size_t length)
634 output += send_all (isock, response, idx_response); 635 output += send_all (isock, response, idx_response);
635 } 636 }
636 } 637 }
637 pthread_mutex_unlock (&MUTEX); 638 if (0 != pthread_mutex_unlock (&MUTEX))
639 abort ();
638 free (response); 640 free (response);
639 return (ssize_t) output; 641 return (ssize_t) output;
640} 642}
@@ -759,7 +761,8 @@ run_usock (void *cls)
759 } 761 }
760 } 762 }
761 } 763 }
762 pthread_mutex_lock (&MUTEX); 764 if (0 != pthread_mutex_lock (&MUTEX))
765 abort ();
763 for (i = 0; i < MAX_CLIENTS; i++) 766 for (i = 0; i < MAX_CLIENTS; i++)
764 { 767 {
765 if (CLIENT_SOCKS[i] == ws->sock) 768 if (CLIENT_SOCKS[i] == ws->sock)
@@ -768,7 +771,8 @@ run_usock (void *cls)
768 break; 771 break;
769 } 772 }
770 } 773 }
771 pthread_mutex_unlock (&MUTEX); 774 if (0 != pthread_mutex_unlock (&MUTEX))
775 abort ();
772 free (ws); 776 free (ws);
773 MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE); 777 MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE);
774 return NULL; 778 return NULL;
@@ -798,7 +802,8 @@ uh_cb (void *cls, struct MHD_Connection *con, void *req_cls,
798 ws->sock = sock; 802 ws->sock = sock;
799 ws->urh = urh; 803 ws->urh = urh;
800 sock_overflow = MHD_YES; 804 sock_overflow = MHD_YES;
801 pthread_mutex_lock (&MUTEX); 805 if (0 != pthread_mutex_lock (&MUTEX))
806 abort ();
802 for (i = 0; i < MAX_CLIENTS; i++) 807 for (i = 0; i < MAX_CLIENTS; i++)
803 { 808 {
804 if (MHD_INVALID_SOCKET == CLIENT_SOCKS[i]) 809 if (MHD_INVALID_SOCKET == CLIENT_SOCKS[i])
@@ -808,7 +813,8 @@ uh_cb (void *cls, struct MHD_Connection *con, void *req_cls,
808 break; 813 break;
809 } 814 }
810 } 815 }
811 pthread_mutex_unlock (&MUTEX); 816 if (0 != pthread_mutex_unlock (&MUTEX))
817 abort ();
812 if (sock_overflow) 818 if (sock_overflow)
813 { 819 {
814 free (ws); 820 free (ws);