Author: gonzalo
Date: 2005-10-10 20:19:16 -0400 (Mon, 10 Oct 2005)
New Revision: 51539

Modified:
   trunk/mod_mono/ChangeLog
   trunk/mod_mono/src/mod_mono.c
   trunk/mod_mono/src/mod_mono.h
Log:
2005-10-10 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * src/mod_mono.[ch]:
        (get_default_socket_name): handle the NULL alias case setting it to
        "default".
        Style fixes and replaced sprintf with apr_psprintf.



Modified: trunk/mod_mono/ChangeLog
===================================================================
--- trunk/mod_mono/ChangeLog    2005-10-11 00:10:15 UTC (rev 51538)
+++ trunk/mod_mono/ChangeLog    2005-10-11 00:19:16 UTC (rev 51539)
@@ -1,3 +1,10 @@
+2005-10-10 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * src/mod_mono.[ch]:
+       (get_default_socket_name): handle the NULL alias case setting it to
+       "default".
+       Style fixes and replaced sprintf with apr_psprintf.
+
 2005-09-23 Joshua Tauberer <[EMAIL PROTECTED]>
 
        * src/mod_mono.c:

Modified: trunk/mod_mono/src/mod_mono.c
===================================================================
--- trunk/mod_mono/src/mod_mono.c       2005-10-11 00:10:15 UTC (rev 51538)
+++ trunk/mod_mono/src/mod_mono.c       2005-10-11 00:19:16 UTC (rev 51539)
@@ -82,7 +82,7 @@
 static int
 search_for_alias (const char *alias, module_cfg *config)
 {
-       // alias may be NULL to search for the default XSP      
+       /* 'alias' may be NULL to search for the default XSP */
        int i;
        xsp_data *xsp;
 
@@ -742,7 +742,7 @@
 static char *
 get_default_socket_name (apr_pool_t *pool, const char *alias, const char *base)
 {
-       return apr_pstrcat (pool, base, "_", alias, NULL);
+       return apr_pstrcat (pool, base, "_", alias == NULL ? "default" : alias, 
NULL);
 }
 
 static apr_status_t 
@@ -1324,15 +1324,13 @@
        if (strcmp (r->handler, "mono"))
                return DECLINED;
 
-       DEBUG_PRINT (1, "handler: %s", r->handler);
        return mono_execute_request (r);
 }
 
 static void
 start_xsp (module_cfg *config, int is_restart, char *alias)
 {
-       // alias may be NULL to start all XSPs
-       
+       /* 'alias' may be NULL to start all XSPs */
        apr_socket_t *sock;
        apr_status_t rv;
        char *termstr = "";
@@ -1353,7 +1351,7 @@
                if (xsp->status != FORK_NONE)
                        continue;
                
-               // If alias isn't null, skip XSPs that don't have that alias.
+               /* If alias isn't null, skip XSPs that don't have that alias. */
                if (alias != NULL && strcmp(xsp->alias, alias))
                        continue;
 
@@ -1390,8 +1388,7 @@
 static apr_status_t
 terminate_xsp2 (void *data, char *alias)
 {
-       // alias may be NULL to terminate all XSPs
-       
+       /* alias may be NULL to terminate all XSPs */
        server_rec *server;
        module_cfg *config;
        apr_socket_t *sock;
@@ -1409,7 +1406,7 @@
                if (xsp->run_xsp && !strcasecmp (xsp->run_xsp, "false"))
                        continue;
 
-               // If alias isn't null, skip XSPs that don't have that alias.
+               /* If alias isn't null, skip XSPs that don't have that alias. */
                if (alias != NULL && strcmp(xsp->alias, alias))
                        continue;
                
@@ -1451,7 +1448,7 @@
        apr_uri_t *uri;
        xsp_data *xsp;
        int i;
-       char buffer[512];
+       char *buffer;
 
        if (strcmp (r->handler, "mono-ctrl"))
                return DECLINED;
@@ -1475,7 +1472,9 @@
                        xsp = &config->servers [i];
                        if (xsp->run_xsp && !strcasecmp (xsp->run_xsp, "false"))
                                continue;
-                       sprintf(buffer, "<li>%s: <a 
href=\"?restart=%s\">Restart Server</a></li>\n", xsp->alias, xsp->alias);
+
+                       buffer = apr_psprintf (r->pool, "<li>%s: <a 
href=\"?restart=%s\">"
+                                                       "Restart 
Server</a></li>\n", xsp->alias, xsp->alias);
                        request_send_response_string(r, buffer);
                }
                
@@ -1483,8 +1482,9 @@
        } else {
                if (uri->query && !strncmp (uri->query, "restart=", 8)) {
                        /* Restart the mod-mono-server processes */
-                       char *alias = uri->query + 8; // +8 == .Substring(8)
-                       if (!strcmp(alias, "ALL")) alias = NULL;
+                       char *alias = uri->query + 8; /* +8 == .Substring(8) */
+                       if (!strcmp (alias, "ALL"))
+                               alias = NULL;
                        terminate_xsp2 (r->server, alias); 
                        start_xsp (config, 1, alias);
                        request_send_response_string (r, "<div 
style=\"text-align: center;\">mod-mono-server processes 
restarted.</div><br>\n");

Modified: trunk/mod_mono/src/mod_mono.h
===================================================================
--- trunk/mod_mono/src/mod_mono.h       2005-10-11 00:10:15 UTC (rev 51538)
+++ trunk/mod_mono/src/mod_mono.h       2005-10-11 00:19:16 UTC (rev 51539)
@@ -64,6 +64,7 @@
 
 #include "multithread.h"
 
+#define apr_psprintf ap_psprintf
 #define apr_uri_t uri_components
 #define apr_pool_t ap_pool
 #define apr_pcalloc_t ap_pcalloc_t

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to