src/server/proxy/httpclient.c

changeset 732
2aeaf6f32861
parent 730
c190ce0aab98
--- a/src/server/proxy/httpclient.c	Sat Mar 14 12:55:23 2026 +0100
+++ b/src/server/proxy/httpclient.c	Sat Mar 14 13:36:39 2026 +0100
@@ -383,6 +383,18 @@
     if(ret) {
         return client->error == 0;
     }
+    log_ereport(LOG_INFORM, "client_process end: %p", event->finish);
+    
+    if(event != &client->event) {
+        // An extern event has called client_process, therefore the
+        // client_finished event callback is not automatically called.
+        // Manually shutdown the client:
+        log_ereport(LOG_INFORM, "client_process: manual shutdown");
+        ev_remove_poll(client->ev, client->socketfd);
+        client_finished(client->ev, &client->event);
+        client->event.fn = NULL;
+        client->event.finish = NULL;
+    }
     
     return 0;
 }
@@ -475,6 +487,7 @@
 
 static int client_finished(EventHandler *ev, Event *event) {
     HttpClient *client = event->cookie;
+    log_ereport(LOG_INFORM, "client_finished: %p", client->response_finished);
     
     close(client->socketfd);
     client->socketfd = -1;
@@ -836,13 +849,21 @@
         }
     }
     
+    if(r == 0) {
+        log_ereport(LOG_INFORM, "client_read_response_body eof");
+    }
+    
     if(r < 0) {
+        if(client->stream->st.io_errno == EWOULDBLOCK) {
+            log_ereport(LOG_INFORM, "client_read_response_body would block");
+        }
+        
         if(client->stream->st.io_errno != EWOULDBLOCK) {
             client->error = 1;
         }
         return 1;
     }
-    
+    log_ereport(LOG_INFORM, "client_read_response_body finished");
     return 0;
 }
 

mercurial