add wait_read to cgi debug logging

Thu, 23 May 2024 14:56:33 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 23 May 2024 14:56:33 +0200
changeset 520
0b09f0cb6098
parent 519
857e5b92828b
child 521
536a2305f3fa

add wait_read to cgi debug logging

src/server/safs/cgi.c file | annotate | diff | comparison | revisions
--- a/src/server/safs/cgi.c	Thu May 23 12:31:30 2024 +0200
+++ b/src/server/safs/cgi.c	Thu May 23 14:56:33 2024 +0200
@@ -327,6 +327,7 @@
                 handler->result = REQ_ABORTED;
             } else {
                 handler->poll_out = TRUE;
+                handler->events++;
                 log_ereport(LOG_DEBUG, "cgi-send: req: %p enable poll out", handler->parser->rq);
                 return 1; // keep readevent active
             }
@@ -559,7 +560,18 @@
     } else if(event->fn == cgi_writeevent) {
         event_fn = "httpout";
     }
-    log_ereport(LOG_DEBUG, "cgi-send: req: %p finish: event: %d pollout: %d cgi_eof: %d fn: %s", rq, handler->events, handler->poll_out, handler->cgi_eof, event_fn);
+    log_ereport(LOG_DEBUG, "cgi-send: req: %p finish: event: %d pollout: %d wait_read: %d cgi_eof: %d fn: %s", rq, handler->events, handler->poll_out, handler->wait_read, handler->cgi_eof, event_fn);
+    
+    if(handler->poll_out) {
+        // write event registered, however it will not be activated anymore
+        // we can safely remove the event
+        log_ereport(LOG_DEBUG, "cgi-send: req: %p finish: remove-poll write", rq);
+        if(event_removepoll(ev, sn->csd)) {
+            log_ereport(LOG_FAILURE, "cgi_event_finish: event_removepoll: %s", strerror(errno));
+        }
+        handler->events--;
+        handler->poll_out = FALSE;
+    }
     
     if(--handler->events > 0) {
         return 0;
@@ -588,14 +600,6 @@
         }
     }
     */
-    if(handler->poll_out) {
-        // write event registered, however it will not be activated anymore
-        // we can safely remove the event
-        log_ereport(LOG_DEBUG, "cgi-send: req: %p finish: remove-poll write", rq);
-        if(event_removepoll(ev, sn->csd)) {
-            log_ereport(LOG_FAILURE, "cgi_event_finish: event_removepoll: %s", strerror(errno));
-        }
-    }
     
     if(handler->result == REQ_ABORTED && handler->process.pid != 0) {
         log_ereport(LOG_FAILURE, "cgi-send: kill script: %s", handler->path);

mercurial