Mercurial > hg > nginx-quic
comparison src/http/ngx_http_busy_lock.c @ 174:ea464a6c0581
nginx-0.0.1-2003-11-05-01:12:39 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 04 Nov 2003 22:12:39 +0000 |
parents | |
children | e92c2c647c57 |
comparison
equal
deleted
inserted
replaced
173:4fb2a2cff023 | 174:ea464a6c0581 |
---|---|
1 | |
2 #include <ngx_config.h> | |
3 #include <ngx_core.h> | |
4 #include <ngx_http.h> | |
5 | |
6 | |
7 char *ngx_http_set_busy_lock_slot(ngx_conf_t *cf, ngx_command_t *cmd, | |
8 void *conf) | |
9 { | |
10 char *p = conf; | |
11 | |
12 int i; | |
13 ngx_str_t *value; | |
14 ngx_http_busy_lock_t *bl, **blp; | |
15 | |
16 blp = (ngx_http_busy_lock_t **) (p + cmd->offset); | |
17 if (*blp) { | |
18 return "is duplicate"; | |
19 } | |
20 | |
21 /* ngx_calloc_shared() */ | |
22 if (!(bl = ngx_pcalloc(cf->pool, sizeof(ngx_http_busy_lock_t)))) { | |
23 return NGX_CONF_ERROR; | |
24 } | |
25 *blp = bl; | |
26 | |
27 value = (ngx_str_t *) cf->args->elts; | |
28 | |
29 for (i = 1; i < 3; i++) { | |
30 | |
31 if (value[i].len > 2 && ngx_strncasecmp(value[i].data, "c:", 2) == 0) { | |
32 if (bl->max_conn) { | |
33 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
34 "duplicate \"%s\"", value[i].data); | |
35 return NGX_CONF_ERROR; | |
36 } | |
37 | |
38 bl->max_conn = ngx_atoi(value[i].data + 2, value[i].len - 2); | |
39 if (bl->max_conn == NGX_ERROR) { | |
40 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
41 "invalid value \"%s\"", value[i].data); | |
42 return NGX_CONF_ERROR; | |
43 } | |
44 | |
45 continue; | |
46 } | |
47 | |
48 if (value[i].len > 2 && ngx_strncasecmp(value[i].data, "w:", 2) == 0) { | |
49 if (bl->max_waiting) { | |
50 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
51 "duplicate \"%s\"", value[i].data); | |
52 return NGX_CONF_ERROR; | |
53 } | |
54 | |
55 bl->max_waiting = ngx_atoi(value[i].data + 2, value[i].len - 2); | |
56 if (bl->max_waiting == NGX_ERROR) { | |
57 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
58 "invalid value \"%s\"", value[i].data); | |
59 return NGX_CONF_ERROR; | |
60 } | |
61 | |
62 continue; | |
63 } | |
64 | |
65 if (bl->timeout) { | |
66 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
67 "duplicate timeout \"%s\"", value[i].data); | |
68 return NGX_CONF_ERROR; | |
69 } | |
70 | |
71 bl->timeout = ngx_parse_time(&value[1], 0); | |
72 if (bl->timeout == NGX_ERROR) { | |
73 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
74 "invalid timeout \"%s\"", value[i].data); | |
75 return NGX_CONF_ERROR; | |
76 } | |
77 } | |
78 | |
79 return NGX_CONF_OK; | |
80 } |