commit f8e3016ce00c974c27657b18d843ebf775415c62
parent 43227e1b181165c6087e72ddcd22f85b690baaec
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 4 Nov 2016 16:36:17 +0100
document new invariants introduced by afe4f08eda64657f268e0d83e204041b2c281194
Diffstat:
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -5495,8 +5495,11 @@ close_all_connections (struct MHD_Daemon *daemon)
if (NULL == susp->urh) /* "Upgraded" connection? */
MHD_PANIC (_("MHD_stop_daemon() called while we have suspended connections.\n"));
#ifdef HTTPS_SUPPORT
- else if (used_tls && used_thr_p_c && MHD_NO == susp->urh->clean_ready)
- shutdown (urh->app.socket, SHUT_RDWR); /* Wake thread by shutdown of app socket. */
+ else if (used_tls &&
+ used_thr_p_c &&
+ (MHD_NO == susp->urh->clean_ready) )
+ shutdown (urh->app.socket,
+ SHUT_RDWR); /* Wake thread by shutdown of app socket. */
#endif /* HTTPS_SUPPORT */
else
{
@@ -5508,7 +5511,7 @@ close_all_connections (struct MHD_Daemon *daemon)
susp->urh->was_closed = MHD_YES;
/* If thread-per-connection is used, connection's thread
* may still processing "upgrade" (exiting). */
- if (!used_thr_p_c)
+ if (! used_thr_p_c)
MHD_connection_finish_forward_ (susp);
/* Do not use MHD_resume_connection() as mutex is
* already locked. */
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
@@ -1015,34 +1015,38 @@ struct MHD_UpgradeResponseHandle
/**
* The buffer for receiving data from TLS to
* be passed to the application. Contains @e in_buffer_size
- * bytes. Do not free!
+ * bytes (unless @e in_buffer_size is zero). Do not free!
*/
char *in_buffer;
/**
* The buffer for receiving data from the application to
* be passed to TLS. Contains @e out_buffer_size
- * bytes. Do not free!
+ * bytes (unless @e out_buffer_size is zero). Do not free!
*/
char *out_buffer;
/**
- * Size of the @e in_buffer
+ * Size of the @e in_buffer. 0 if the connection went down for reading.
*/
size_t in_buffer_size;
/**
- * Size of the @e out_buffer
+ * Size of the @e out_buffer. 0 if the connection went down for writing.
*/
size_t out_buffer_size;
/**
- * Number of bytes actually in use in the @e in_buffer
+ * Number of bytes actually in use in the @e in_buffer. Can be larger
+ * than @e in_buffer_size if and only if @a in_buffer_size is zero and
+ * we still have bytes to process in the buffer.
*/
size_t in_buffer_used;
/**
- * Number of bytes actually in use in the @e out_buffer
+ * Number of bytes actually in use in the @e out_buffer. Can be larger
+ * than @e out_buffer_size if and only if @a out_buffer_size is zero and
+ * we still have bytes to process in the buffer.
*/
size_t out_buffer_used;