diff options
Diffstat (limited to 'src/microhttpd/test_upgrade.c')
-rw-r--r-- | src/microhttpd/test_upgrade.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c index e9836461..8b835649 100644 --- a/src/microhttpd/test_upgrade.c +++ b/src/microhttpd/test_upgrade.c | |||
@@ -470,8 +470,9 @@ notify_completed_cb (void *cls, | |||
470 | (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && | 470 | (toe != MHD_REQUEST_TERMINATED_CLIENT_ABORT) && |
471 | (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) | 471 | (toe != MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN) ) |
472 | abort (); | 472 | abort (); |
473 | if (((long) *con_cls) != (long) pthread_self ()) | 473 | if (! pthread_equal (**((pthread_t**)con_cls), pthread_self ())) |
474 | abort (); | 474 | abort (); |
475 | free (*con_cls); | ||
475 | *con_cls = NULL; | 476 | *con_cls = NULL; |
476 | } | 477 | } |
477 | 478 | ||
@@ -489,10 +490,15 @@ log_cb (void *cls, | |||
489 | const char *uri, | 490 | const char *uri, |
490 | struct MHD_Connection *connection) | 491 | struct MHD_Connection *connection) |
491 | { | 492 | { |
493 | pthread_t* ppth; | ||
492 | if (0 != strcmp (uri, | 494 | if (0 != strcmp (uri, |
493 | "/")) | 495 | "/")) |
494 | abort (); | 496 | abort (); |
495 | return (void *) (long) pthread_self (); | 497 | ppth = (pthread_t*) malloc (sizeof(pthread_t)); |
498 | if (NULL == ppth) | ||
499 | abort(); | ||
500 | *ppth = pthread_self (); | ||
501 | return (void *) ppth; | ||
496 | } | 502 | } |
497 | 503 | ||
498 | 504 | ||
@@ -839,7 +845,9 @@ ahc_upgrade (void *cls, | |||
839 | struct MHD_Response *resp; | 845 | struct MHD_Response *resp; |
840 | int ret; | 846 | int ret; |
841 | 847 | ||
842 | if (((long) *con_cls) != (long) pthread_self ()) | 848 | if (NULL == *con_cls) |
849 | abort (); | ||
850 | if (! pthread_equal (**((pthread_t**)con_cls), pthread_self ())) | ||
843 | abort (); | 851 | abort (); |
844 | resp = MHD_create_response_for_upgrade (&upgrade_cb, | 852 | resp = MHD_create_response_for_upgrade (&upgrade_cb, |
845 | NULL); | 853 | NULL); |