+ if (!has_data) {
+ // The wait timed out, so tell microhttpd to clean out the socket;
+ // it's not unlikely that the client has given up anyway.
+ // This is seemingly the only way to actually reap sockets if we
+ // do not get any data; returning 0 does nothing, and
+ // MHD_OPTION_NOTIFY_CONNECTION does not trigger for these cases.
+ // If not, an instance that has no data to send (typically an instance
+ // of kaeru connected to a nonfunctional backend) would get a steadily
+ // increasing amount of sockets in CLOSE_WAIT (ie., the other end has
+ // hung up, but we haven't called close() yet, as our thread is stuck
+ // in this callback).
+ return -1;
+ }