summaryrefslogtreecommitdiff
path: root/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c')
-rw-r--r--www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c b/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c
index 39b9bb3c11df..e6b4bad6e25f 100644
--- a/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c
+++ b/www/nginx-devel/files/extra-patch-ngx_http_sflow_module.c
@@ -1,17 +1,16 @@
---- ../nginx-sflow-module-0.9.7/ngx_http_sflow_module.c.orig 2015-04-21 21:21:17.020547000 +0300
-+++ ../nginx-sflow-module-0.9.7/ngx_http_sflow_module.c 2015-04-21 21:22:26.994714000 +0300
-@@ -8,10 +8,6 @@
+--- ../nginx-sflow-module-543c72a/ngx_http_sflow_module.c.orig 2014-09-24 18:20:41.000000000 -0400
++++ ../nginx-sflow-module-543c72a/ngx_http_sflow_module.c 2016-08-06 21:26:24.515559000 -0400
+@@ -8,9 +8,6 @@
#include <ngx_http.h>
#include <nginx.h>
-#if (NGX_THREADS)
-#include <ngx_thread.h>
-#endif
--
+
#include "ngx_http_sflow_api.h"
#include "ngx_http_sflow_config.h"
-
-@@ -42,18 +38,10 @@
+@@ -74,18 +71,10 @@
/* keep log ptr for callbacks */
ngx_log_t *log;
@@ -28,12 +27,12 @@
#define SFWB_COUNTDOWN(_c) (--(_c) == 0)
-#endif
- /* delegate acquiring the sflow config */
- SFWBConfigManager *config_manager;
-@@ -411,13 +399,8 @@
- static int32_t ngx_http_sflow_add_random_skip(SFWB *sm)
+ /* skip countdown is handled per-worker to reduce lock contention.
+ * If all processes sample at 1:N it's the same as having only one
+@@ -645,13 +634,8 @@
{
- ngx_atomic_t next_skip = sfl_sampler_next_skip(sm->sampler);
+ sm->random_seed = ((sm->random_seed * 32719) + 3) % 32749;
+ ngx_atomic_t next_skip = (sm->random_seed % ((2 * sm->sampling_rate) - 1)) + 1;
-#if (NGX_THREADS)
- ngx_atomic_int_t test_skip = ngx_atomic_fetch_add(&sm->sflow_skip, next_skip);
- return (test_skip + next_skip);
@@ -44,17 +43,17 @@
}
/*_________________---------------------------__________________
-@@ -528,13 +511,6 @@
- /* a pool to use for the agent so we can recycle the memory easily on a config change */
- sm->masterPool = ngx_create_pool(SFWB_POOL_SIZ, cf->log);
+@@ -864,13 +848,6 @@
+ {
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cf->log, 0, "sflow: sfwb_init()");
-#if (NGX_THREADS)
- /* a mutex to lock the sFlow agent when taking a sample (only needed if there
-- is more that one worker thread - right now it seems like threads are not even
-- an option in the configure script) */
+- * is more that one worker thread - right now it seems like threads are not even
+- * an option in the configure script)
+- */
- sm->mut = ngx_mutex_init(cf->log, 0);
-#endif
--
- /* create and initialze the config_manager */
- sm->config_manager = ngx_pcalloc(cf->pool, sizeof(SFWBConfigManager));
- sfwb_config_init(sm->config_manager, cf->log);
+
+ /* look up some vars by name and cache the index numbers -- see ngx_http_variables.c */
+ ngx_str_t str_uri = ngx_string("request_uri"); /* the "unparsed" variant */