diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-10-17 10:43:20 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-10-17 10:43:20 +0200 |
commit | 599561d60c0c5769b4cebb525d81aa4efa9688f4 (patch) | |
tree | cf37df0c560724a00a15893531929dff0fe23554 | |
parent | 71806e71a661a0132f2c6d1b6c74a7ee73bb67e3 (diff) | |
download | libmicrohttpd-599561d60c0c5769b4cebb525d81aa4efa9688f4.tar.gz libmicrohttpd-599561d60c0c5769b4cebb525d81aa4efa9688f4.zip |
fix test_ugprade test, who put the && instead of & all over the place...
-rw-r--r-- | src/microhttpd/daemon.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 5e2ff2ce..7d202193 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -923,16 +923,12 @@ void | |||
923 | MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection) | 923 | MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection) |
924 | { | 924 | { |
925 | struct MHD_Daemon *daemon = connection->daemon; | 925 | struct MHD_Daemon *daemon = connection->daemon; |
926 | struct MHD_UpgradeResponseHandle *urh; | 926 | struct MHD_UpgradeResponseHandle *urh = connection->urh; |
927 | |||
928 | urh = connection->urh; | ||
929 | if (NULL == urh) | ||
930 | return; | ||
931 | 927 | ||
932 | #if HTTPS_SUPPORT | 928 | #if HTTPS_SUPPORT |
933 | if (0 != (daemon->options && MHD_USE_TLS)) | 929 | if (0 != (daemon->options & MHD_USE_TLS)) |
934 | { | 930 | { |
935 | if (0 == (daemon->options && MHD_USE_THREAD_PER_CONNECTION)) | 931 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) |
936 | DLL_remove (daemon->urh_head, | 932 | DLL_remove (daemon->urh_head, |
937 | daemon->urh_tail, | 933 | daemon->urh_tail, |
938 | urh); | 934 | urh); |
@@ -974,13 +970,14 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection) | |||
974 | MHD_socket_close_chk_ (urh->app.socket); | 970 | MHD_socket_close_chk_ (urh->app.socket); |
975 | } | 971 | } |
976 | #endif /* HTTPS_SUPPORT */ | 972 | #endif /* HTTPS_SUPPORT */ |
977 | if (0 == (daemon->options && MHD_USE_THREAD_PER_CONNECTION)) | 973 | if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) |
978 | MHD_resume_connection (connection); | 974 | MHD_resume_connection (connection); |
979 | |||
980 | MHD_connection_close_ (connection, | 975 | MHD_connection_close_ (connection, |
981 | MHD_REQUEST_TERMINATED_COMPLETED_OK); | 976 | MHD_REQUEST_TERMINATED_COMPLETED_OK); |
977 | |||
982 | connection->urh = NULL; | 978 | connection->urh = NULL; |
983 | free (urh); | 979 | if (NULL != urh) |
980 | free (urh); | ||
984 | } | 981 | } |
985 | 982 | ||
986 | 983 | ||
@@ -990,8 +987,10 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection) | |||
990 | * based on the readyness state stored in the @a urh handle. | 987 | * based on the readyness state stored in the @a urh handle. |
991 | * | 988 | * |
992 | * @param urh handle to process | 989 | * @param urh handle to process |
990 | * @return #MHD_YES if we are done reading from the socket, | ||
991 | * #MHD_NO if there might be more data to be read | ||
993 | */ | 992 | */ |
994 | static void | 993 | static int |
995 | process_urh (struct MHD_UpgradeResponseHandle *urh) | 994 | process_urh (struct MHD_UpgradeResponseHandle *urh) |
996 | { | 995 | { |
997 | int fin_read; | 996 | int fin_read; |
@@ -1123,6 +1122,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1123 | urh->out_buffer_off = 0; | 1122 | urh->out_buffer_off = 0; |
1124 | } | 1123 | } |
1125 | } | 1124 | } |
1125 | return fin_read; | ||
1126 | } | 1126 | } |
1127 | #endif | 1127 | #endif |
1128 | 1128 | ||
@@ -2776,16 +2776,19 @@ MHD_run_from_select (struct MHD_Daemon *daemon, | |||
2776 | #if HTTPS_SUPPORT | 2776 | #if HTTPS_SUPPORT |
2777 | for (urh = daemon->urh_head; NULL != urh; urh = urhn) | 2777 | for (urh = daemon->urh_head; NULL != urh; urh = urhn) |
2778 | { | 2778 | { |
2779 | int fin_read; | ||
2780 | |||
2779 | urhn = urh->next; | 2781 | urhn = urh->next; |
2780 | /* update urh state based on select() output */ | 2782 | /* update urh state based on select() output */ |
2781 | urh_from_fdset (urh, | 2783 | urh_from_fdset (urh, |
2782 | read_fd_set, | 2784 | read_fd_set, |
2783 | write_fd_set); | 2785 | write_fd_set); |
2784 | /* call generic forwarding function for passing data */ | 2786 | /* call generic forwarding function for passing data */ |
2785 | process_urh (urh); | 2787 | fin_read = process_urh (urh); |
2786 | /* cleanup connection if it was closed and all data was sent */ | 2788 | /* cleanup connection if it was closed and all data was sent */ |
2787 | if ( (MHD_YES == urh->was_closed) && | 2789 | if ( (MHD_YES == urh->was_closed) && |
2788 | (0 == urh->out_buffer_off) ) | 2790 | (0 == urh->out_buffer_off) && |
2791 | (MHD_YES == fin_read) ) | ||
2789 | MHD_cleanup_upgraded_connection_ (urh->connection); | 2792 | MHD_cleanup_upgraded_connection_ (urh->connection); |
2790 | } | 2793 | } |
2791 | #endif | 2794 | #endif |