aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-10-28 19:49:57 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-10-28 19:49:57 +0300
commit7d0221189929a3251d956166f82b06c456b33ed9 (patch)
tree69bae617f50e5e5eb3d0f9ca87b0723ef071f01e
parentdd327c1d13252373cd1730e445d19930417571bf (diff)
downloadlibmicrohttpd-7d0221189929a3251d956166f82b06c456b33ed9.tar.gz
libmicrohttpd-7d0221189929a3251d956166f82b06c456b33ed9.zip
Fixed data races in thread-per-connection mode.
-rw-r--r--src/microhttpd/daemon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index da764ca3..fcbfe105 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1770,8 +1770,9 @@ exit:
1770 { 1770 {
1771 shutdown (con->socket_fd, 1771 shutdown (con->socket_fd,
1772 SHUT_WR); 1772 SHUT_WR);
1773 MHD_socket_close_chk_ (con->socket_fd); 1773 /* 'socket_fd' can be used in other thread to signal shutdown.
1774 con->socket_fd = MHD_INVALID_SOCKET; 1774 * To avoid data races, do not close socket here. Daemon will
1775 * use more connections only after cleanup anyway. */
1775 } 1776 }
1776 return (MHD_THRD_RTRN_TYPE_) 0; 1777 return (MHD_THRD_RTRN_TYPE_) 0;
1777} 1778}