diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-10-28 19:49:57 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-10-28 19:49:57 +0300 |
commit | 7d0221189929a3251d956166f82b06c456b33ed9 (patch) | |
tree | 69bae617f50e5e5eb3d0f9ca87b0723ef071f01e | |
parent | dd327c1d13252373cd1730e445d19930417571bf (diff) |
Fixed data races in thread-per-connection mode.
-rw-r--r-- | src/microhttpd/daemon.c | 5 |
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: { shutdown (con->socket_fd, SHUT_WR); - MHD_socket_close_chk_ (con->socket_fd); - con->socket_fd = MHD_INVALID_SOCKET; + /* 'socket_fd' can be used in other thread to signal shutdown. + * To avoid data races, do not close socket here. Daemon will + * use more connections only after cleanup anyway. */ } return (MHD_THRD_RTRN_TYPE_) 0; } |