diff --git a/mod_vhost_limit.cpp b/mod_vhost_limit.cpp index 950fbd5..bab732e 100644 --- a/mod_vhost_limit.cpp +++ b/mod_vhost_limit.cpp @@ -129,18 +129,23 @@ static int handle_r(request_rec *r) if (data->counter >= conf->max_clients) { - ap_log_error(APLOG_MARK, APLOG_INFO, 0,NULL,"%s: Access to %s deferred, Max Clients %d exceeded (%d currently)",MOD_NAME, conf->name, conf->max_clients, data->counter); + ap_log_error(APLOG_MARK, APLOG_WARNING, 0,NULL,"%s: Access to %s deferred, Max Clients %d exceeded (%d currently)",MOD_NAME, conf->name, conf->max_clients, data->counter); return HTTP_SERVICE_UNAVAILABLE; } char *s = (char*) apr_pcalloc(pool, sizeof(char)*8); apr_snprintf(s,8,"%d",conf->sid); apr_table_t *table = r->connection->notes; - apr_table_setn(table,"sid", s ); - apr_atomic_add32(&data->counter,1); - - ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0 ,NULL, "%s: handling IN %s (%s) = %d", MOD_NAME, conf->name, s, data->counter); + const char *existing_sid = apr_table_get(table, "sid"); + if (existing_sid == NULL) { + apr_table_setn(table,"sid", s ); + apr_atomic_add32(&data->counter,1); + ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0 ,NULL, "%s: handling IN %s (%s) = %d", MOD_NAME, conf->name, s, data->counter); + } + else { + ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0 ,NULL, "%s: sid already exists = %d", MOD_NAME, conf->name, s); + } return DECLINED; }