about summary refs log tree commit homepage
path: root/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'http.c')
-rw-r--r--http.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/http.c b/http.c
index 74ca982..a4c2cb8 100644
--- a/http.c
+++ b/http.c
@@ -95,6 +95,31 @@ MOG_NOINLINE static void http_close(struct mog_fd *mfd)
         mog_fd_put(mfd);
 }
 
+void mog_http_unlink_ftmp(struct mog_http *http)
+{
+        struct mog_file *file = &http->forward->as.file;
+
+        if (!file->tmppath)
+                return;
+
+        if (mog_unlink(http->svc, file->tmppath) != 0)
+                syslog(LOG_ERR, "Failed to unlink %s (in %s): %m",
+                       file->tmppath, http->svc->docroot);
+}
+
+/* called if epoll/kevent is out-of-space */
+void mog_http_drop(struct mog_fd *mfd)
+{
+        struct mog_http *http = &mfd->as.http;
+
+        assert(http->forward != MOG_IOSTAT);
+        if (http->forward) {
+                mog_http_unlink_ftmp(http);
+                mog_file_close(http->forward);
+        }
+        http_close(mfd);
+}
+
 /* returns true if we can continue queue step, false if not */
 static enum mog_next http_wbuf_in_progress(struct mog_http *http)
 {