Davi Arnaut wrote:


Em 28/07/2006, às 13:34, [EMAIL PROTECTED] escreveu:

Author: jfclere
Date: Fri Jul 28 09:33:58 2006
New Revision: 426604


...

+
+static const slotmem_storage_method *checkstorage = NULL;
+static ap_slotmem_t *myscore=NULL;


Indentation consistency ? "myscore=NULL"

fixed.


+
+    if (!port) {
+        if (strcmp(scheme, "ajp") == 0)
+            port = 8009;
+        else if (strcmp(scheme, "http") == 0)
+            port = 80;
+        else
+            port = 443;
+    }


apr_uri_port_of_scheme ? (it may not have the ajp scheme, a patch is appreciated)

Done.



+ rv = apr_sockaddr_info_get(&epsv_addr, hostname, APR_INET, port, 0, pool);
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
+                     "apr_sockaddr_info_get failed");
+        apr_socket_close(newsock);
+        return rv;
+    }



ap_log_error(..APLOG_ERR, rv, NULL..) so we may have a hint why it failed

Yep.


+    rv = apr_socket_timeout_set(newsock, 10);
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
+                    "apr_socket_timeout_set");
+        apr_socket_close(newsock);
+        return rv;


same for ap_log_error

+    rv = apr_socket_connect(newsock, epsv_addr);
+    if (rv != APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
+                    "apr_socket_connect failed");
+        apr_socket_close(newsock);
+        return rv;
+    }


same for ap_log_error..and so on.

+
+    if (balancer_name)
+        strcpy(workerconf->balancer_name, balancer_name);
+    workerconf->id = worker->id;
+    workerconf->retry = worker->retry;
+    workerconf->lbfactor = worker->lbfactor;
+    if (worker->name)
+        strcpy(workerconf->name, worker->name);
+    if (worker->scheme)
+        strcpy(workerconf->scheme, worker->scheme);
+    if (worker->hostname)
+        strcpy(workerconf->hostname, worker->hostname);
+    if (worker->route)
+        strcpy(workerconf->route, worker->route);
+    if (worker->redirect)
+        strcpy(workerconf->redirect, worker->redirect);


strncpy ?

Ok fixed.


+    /* allocate the data */
+    *worker = apr_pcalloc(pool, sizeof(proxy_worker));
+    if (workerconf->balancer_name)
+ *balancer_name = apr_pcalloc(pool, strlen(workerconf- >balancer_name));
+    else
+        *balancer_name = NULL;


allocated for what ? the string is not copied. Also, shoudn't it be strlen(..) + 1 ?

Fixed.



+/* make the module usuable from outside */
+health_worker_method *health_checker_get_storage()
+{
+    return(&worker_storage);
+}
+
+/* handle the slotmem storage */
+void health_checker_init_slotmem_storage(slotmem_storage_method * storage)
+{
+    checkstorage = storage;
+}
+slotmem_storage_method * health_checker_get_slotmem_storage()
+{
+    return(checkstorage);
+}
+
+/* handle the slotmen itself */
+void health_checker_init_slotmem(ap_slotmem_t *score)
+{
+     myscore = score;
+}
+ap_slotmem_t *health_checker_get_slotmem()
+{
+    return(myscore);
+}


static APR_INLINE ...

No, why?


+char * ap_server_root_relative(apr_pool_t *p, const char *name)
+{
+    char *fname;
+
+    /* XXX: apr_filepath_merge better ? */
+    if (basedir && name[0] != '/') {
+        fname = apr_pcalloc(p, strlen(basedir)+strlen(name)+1);
+        strcpy(fname, basedir);
+        strcat(fname, "/");
+        strcat(fname, name);


apr_pstrcat ?

Yes, done





Reply via email to