Skip to content
This repository
Browse code

added push_message_buffer_length setting

  • Loading branch information...
commit c75c092e5921ed1676d1ac7757352acfe1d50242 1 parent edcd100
Leo P. authored November 06, 2009
7  README
@@ -75,6 +75,13 @@ push_max_message_buffer_length [ number ]
75 75
   The maximum number of messages to store per channel. A channel's message
76 76
   buffer will retain at most this many most recent messages.
77 77
 
  78
+push_message_buffer_length [ number ]
  79
+  default: none
  80
+  context: http, server, location
  81
+  The exact number of messages to store per channel. Sets both
  82
+  push_max_message_buffer_length and push_min_message_buffer_length to this 
  83
+  value.
  84
+  
78 85
 push_min_message_recipients [ number ]
79 86
   default: 0
80 87
   context: http, server, location
1  changelog.txt
... ...
@@ -1,3 +1,4 @@
  1
+ feature: added push_message_buffer_length setting, which sets push_message_max_buffer_length and push_message_min_buffer_length at once.
1 2
  fix: publisher channel info text/json response now uses double quotes instead of single.
2 3
  fix: interprocess messages were not removed from shared memory correctly, causing weird errors
3 4
 0.68 (Nov. 5 2009)
26  src/ngx_http_push_module_setup.c
@@ -228,6 +228,25 @@ static void ngx_http_push_exit_master(ngx_cycle_t *cycle) {
228 228
 	ngx_shmtx_unlock(&shpool->mutex);
229 229
 }
230 230
 
  231
+static char *ngx_http_push_set_message_buffer_length(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {
  232
+	char                           *p = conf;
  233
+	ngx_int_t                      *min, *max;
  234
+	ngx_str_t                      *value;
  235
+	ngx_int_t                       intval;
  236
+	min = (ngx_int_t *) (p + offsetof(ngx_http_push_loc_conf_t, min_messages));
  237
+	max = (ngx_int_t *) (p + offsetof(ngx_http_push_loc_conf_t, max_messages));
  238
+	if(*min != NGX_CONF_UNSET || *max != NGX_CONF_UNSET) {
  239
+		return "is duplicate";
  240
+	}
  241
+	value = cf->args->elts;
  242
+	if((intval = ngx_atoi(value[1].data, value[1].len))==NGX_ERROR) {
  243
+		return "invalid number";
  244
+	}
  245
+	*min = intval;
  246
+	*max = intval;
  247
+	
  248
+	return NGX_CONF_OK;
  249
+}
231 250
 
232 251
 
233 252
 static ngx_command_t  ngx_http_push_commands[] = {
@@ -260,6 +279,13 @@ static ngx_command_t  ngx_http_push_commands[] = {
260 279
       offsetof(ngx_http_push_loc_conf_t, max_messages),
261 280
       NULL },
262 281
 	  
  282
+	{ ngx_string("push_message_buffer_length"),
  283
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
  284
+      ngx_http_push_set_message_buffer_length,
  285
+      NGX_HTTP_LOC_CONF_OFFSET,
  286
+      0,
  287
+      NULL },
  288
+	  
263 289
 	{ ngx_string("push_min_message_recipients"),
264 290
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
265 291
       ngx_conf_set_num_slot,

0 notes on commit c75c092

Please sign in to comment.
Something went wrong with that request. Please try again.