On Oct 3, 2009, at 3:54 PM, Ruediger Pluem wrote:


On 03.10.2009 14:54, j...@apache.org wrote:
Author: jim
Date: Sat Oct  3 12:54:35 2009
New Revision: 821307

URL: http://svn.apache.org/viewvc?rev=821307&view=rev
Log:
Provide new  ap_update_child_status_from_conn() mostly
for use with mod_noloris.c Add some logic protection, for
NULL ref, which shoulda be there in any case.

Modified:
   httpd/httpd/trunk/include/scoreboard.h
   httpd/httpd/trunk/modules/experimental/mod_noloris.c
   httpd/httpd/trunk/server/scoreboard.c


Modified: httpd/httpd/trunk/modules/experimental/mod_noloris.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/experimental/mod_noloris.c?rev=821307&r1=821306&r2=821307&view=diff
=
=
=
=
=
=
=
=
=
=====================================================================
--- httpd/httpd/trunk/modules/experimental/mod_noloris.c (original)
+++ httpd/httpd/trunk/modules/experimental/mod_noloris.c Sat Oct 3 12:54:35 2009
@@ -57,17 +57,9 @@

static int noloris_conn(conn_rec *conn)
{
-    /*** FIXME
- * This is evil: we're assuming info that's private to the scoreboard - * We need to do that because there's no API to update the scoreboard - * on a connection, only with a request (or NULL to say not processing - * any request). We need a version of ap_update_child_status that
-     * accepts a conn_rec.
-     */
    struct { int child_num; int thread_num; } *sbh = conn->sbh;

Hm. Shouldn't we remove the line above as well now that the comment is gone?


    char *shm_rec;
-    worker_score *ws;
    if (shm == NULL) {
        return DECLINED;  /* we're disabled */
    }

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=821307&r1=821306&r2=821307&view=diff
= = = = = = = = = =====================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Sat Oct  3 12:54:35 2009
@@ -490,6 +492,19 @@
                                               status, r);
}

+AP_DECLARE(int) ap_update_child_status_from_conn(ap_sb_handle_t *sbh, int status,
+                                       conn_rec *c)
+{
+    if (!sbh)
+        return -1;
+
+    request_rec fake_rec;
+    fake_rec.connection = c;

Shouldn't we set fake_rec.per_dir_config and fake_rec.server to NULL to play safe?


No because if you follow the code, a null fake_rec.per_dir_config is handled correctly
as is a null server. The only one that wasn't was the one that required
the change to the double-possible NULL.

Reply via email to