Skip to content

Commit

Permalink
git-svn-id: svn://cherokee-project.com/cherokee/trunk@2989 5dc97367-9…
Browse files Browse the repository at this point in the history
…7f1-0310-9951-d761b3857238
  • Loading branch information
alobbs committed Mar 18, 2009
1 parent 4a75eb4 commit 6c666bf
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,5 +1,14 @@
2009-03-18 Alvaro Lopez Ortega <alvaro@octality.com>

* cherokee/virtual_server.h: Added the "collect_statistics"
configuration key, so it can be defined whether or not a virtual
server should collected traffic statistics.

* admin/PageVServer.py (PageVServer._op_apply_changes): Updates it
to support the new "collect_statistics" key.

* performance.conf.sample.pre: Don't collect statistics.

* 0.99.5 released

2009-03-17 Alvaro Lopez Ortega <alvaro@octality.com>
Expand Down
8 changes: 5 additions & 3 deletions admin/PageVServer.py
Expand Up @@ -39,6 +39,7 @@
NOTE_DIRECTORY_INDEX = 'List of name files that will be used as directory index. Eg: <em>index.html,index.php</em>.'
NOTE_MAX_UPLOAD_SIZE = 'The maximum size, in bytes, for POST uploads. (Default: unlimited)'
NOTE_KEEPALIVE = 'Whether this virtual server is allowed to use Keep-alive (Default: yes)'
NOTE_COLLECT = 'Specifies if Traffic Statistics should be collected for the virtual server (Default: yes)'
NOTE_DISABLE_LOG = 'The Logging is currently enabled.'
NOTE_LOGGERS = 'Logging format. Apache compatible is highly recommended here.'
NOTE_ACCESSES = 'Back-end used to store the log accesses.'
Expand Down Expand Up @@ -425,8 +426,9 @@ def _render_basics (self, host):

txt += '<h2>Network</h2>'
table = TableProps()
self.AddPropCheck (table, 'Keep-alive', '%s!keepalive'%(pre), True, NOTE_KEEPALIVE)
self.AddPropEntry (table, 'Max Upload Size', '%s!post_max_len' % (pre), NOTE_MAX_UPLOAD_SIZE)
self.AddPropCheck (table, 'Keep-alive', '%s!keepalive'%(pre), True, NOTE_KEEPALIVE)
self.AddPropEntry (table, 'Max Upload Size', '%s!post_max_len' % (pre), NOTE_MAX_UPLOAD_SIZE)
self.AddPropCheck (table, 'Traffic Statistics', '%s!collect_statistics'%(pre), True, NOTE_COLLECT)
txt += self.Indent(table)

return txt
Expand Down Expand Up @@ -556,7 +558,7 @@ def _op_apply_changes (self, host, uri, post):
self.ApplyChanges_OptionModule ('%s!error_handler'%(pre), uri, post)

# Look for the checkboxes
checkboxes = ['%s!keepalive'%(pre)]
checkboxes = ['%s!keepalive'%(pre), '%s!collect_statistics'%(pre)]
tmp = self._cfg['%s!rule'%(pre)]
if tmp and tmp.has_child():
for p in tmp:
Expand Down
3 changes: 2 additions & 1 deletion cherokee/thread.c
Expand Up @@ -631,7 +631,8 @@ process_active_connections (cherokee_thread_t *thd)

/* Maybe update traffic counters
*/
if ((conn->traffic_next < thd->bogo_now) &&
if ((CONN_VSRV(vserver)->data.enabled) &&
(conn->traffic_next < thd->bogo_now) &&
((conn->rx != 0) || (conn->tx != 0)))
{
cherokee_connection_update_vhost_traffic (conn);
Expand Down
4 changes: 4 additions & 0 deletions cherokee/virtual_server.c
Expand Up @@ -69,6 +69,7 @@ cherokee_virtual_server_new (cherokee_virtual_server_t **vserver, void *server)

/* Data transference
*/
n->data.enabled = true;
n->data.rx = 0;
n->data.tx = 0;
CHEROKEE_MUTEX_INIT(&n->data.rx_mutex, NULL);
Expand Down Expand Up @@ -700,6 +701,9 @@ configure_virtual_server_property (cherokee_config_node_t *conf, void *data)
} else if (equal_buf_str (&conf->key, "post_max_len")) {
vserver->post_max_len = atoi (conf->val.buf);

} else if (equal_buf_str (&conf->key, "collect_statistics")) {
vserver->data.enabled = !! atoi (conf->val.buf);

} else if (equal_buf_str (&conf->key, "ssl_verify_depth")) {
vserver->verify_depth = !!atoi (conf->val.buf);

Expand Down
1 change: 1 addition & 0 deletions cherokee/virtual_server.h
Expand Up @@ -66,6 +66,7 @@ typedef struct {
off_t rx;
CHEROKEE_MUTEX_T (tx_mutex);
CHEROKEE_MUTEX_T (rx_mutex);
cherokee_boolean_t enabled;
} data;

cuint_t verify_depth;
Expand Down
3 changes: 2 additions & 1 deletion performance.conf.sample.pre
Expand Up @@ -9,7 +9,7 @@
# Server
#
server!bind!1!port = 80
server!timeout = 20
server!timeout = 5
server!keepalive = 1
server!keepalive_max_requests = 1000
server!server_tokens = full
Expand All @@ -19,6 +19,7 @@ server!pid_file = %localstatedir%/run/cherokee.pid
# Default virtual server
#
vserver!1!nick = default
vserver!1!collect_statistics = 0
vserver!1!document_root = %wwwroot%
vserver!1!rule!1!match = default
vserver!1!rule!1!handler = file

0 comments on commit 6c666bf

Please sign in to comment.