agoo 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of agoo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/agoo/ccache.c +10 -10
- data/ext/agoo/debug.c +17 -0
- data/ext/agoo/debug.h +3 -0
- data/ext/agoo/text.c +6 -4
- data/lib/agoo/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da2816b985fc556221634cd9002ddf9a2fd2a33c5e0ddc09c897ef8d9c686afc
|
4
|
+
data.tar.gz: c99f5e5679c4b837dfd3ff2bbed6425905c1d41295666c82e5d0779811a2a202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eacde94a5ec77f4901fafc4bc6e2424729b4edbfbe40c9151f16fbb84ef354f7400ad463fd8b7c91120c40b65e7a86f734aafbd3657a7138b71a259a35eccd1
|
7
|
+
data.tar.gz: 0c649ea6946255f17903b623dc8fd3767e0a712355bc4556d2a2a511017e8abfefaf4f3acff7fddd57fe3714559ff6ecdd5134fcbe104bde900a688d97c8322d
|
data/CHANGELOG.md
CHANGED
data/ext/agoo/ccache.c
CHANGED
@@ -64,7 +64,7 @@ cc_set_con(CCache cc, Con con) {
|
|
64
64
|
|
65
65
|
pthread_mutex_lock(&cc->lock);
|
66
66
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
67
|
-
if (con->id
|
67
|
+
if (con->id == slot->cid) {
|
68
68
|
slot->con = con;
|
69
69
|
break;
|
70
70
|
}
|
@@ -97,7 +97,7 @@ cc_set_handler(CCache cc, uint64_t cid, VALUE handler, bool on_empty, bool on_cl
|
|
97
97
|
|
98
98
|
pthread_mutex_lock(&cc->lock);
|
99
99
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
100
|
-
if (cid
|
100
|
+
if (cid == slot->cid) {
|
101
101
|
slot->handler = handler;
|
102
102
|
break;
|
103
103
|
}
|
@@ -134,7 +134,7 @@ cc_remove(CCache cc, uint64_t cid) {
|
|
134
134
|
|
135
135
|
pthread_mutex_lock(&cc->lock);
|
136
136
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
137
|
-
if (cid
|
137
|
+
if (cid == slot->cid) {
|
138
138
|
if (NULL == prev) {
|
139
139
|
*bucket = slot->next;
|
140
140
|
} else {
|
@@ -159,7 +159,7 @@ cc_remove_con(CCache cc, uint64_t cid) {
|
|
159
159
|
|
160
160
|
pthread_mutex_lock(&cc->lock);
|
161
161
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
162
|
-
if (cid
|
162
|
+
if (cid == slot->cid) {
|
163
163
|
if (atomic_fetch_sub(&slot->ref_cnt, 1) <= 1) {
|
164
164
|
if (NULL == prev) {
|
165
165
|
*bucket = slot->next;
|
@@ -190,7 +190,7 @@ cc_ref_dec(CCache cc, uint64_t cid) {
|
|
190
190
|
|
191
191
|
pthread_mutex_lock(&cc->lock);
|
192
192
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
193
|
-
if (cid
|
193
|
+
if (cid == slot->cid) {
|
194
194
|
int rcnt = atomic_fetch_sub(&slot->ref_cnt, 1);
|
195
195
|
|
196
196
|
handler = slot->handler;
|
@@ -223,7 +223,7 @@ cc_get_con(CCache cc, uint64_t cid) {
|
|
223
223
|
|
224
224
|
pthread_mutex_lock(&cc->lock);
|
225
225
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
226
|
-
if (cid
|
226
|
+
if (cid == slot->cid) {
|
227
227
|
con = slot->con;
|
228
228
|
break;
|
229
229
|
}
|
@@ -241,7 +241,7 @@ cc_get_handler(CCache cc, uint64_t cid) {
|
|
241
241
|
|
242
242
|
pthread_mutex_lock(&cc->lock);
|
243
243
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
244
|
-
if (cid
|
244
|
+
if (cid == slot->cid) {
|
245
245
|
handler = slot->handler;
|
246
246
|
break;
|
247
247
|
}
|
@@ -259,7 +259,7 @@ cc_get_pending(CCache cc, uint64_t cid) {
|
|
259
259
|
|
260
260
|
pthread_mutex_lock(&cc->lock);
|
261
261
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
262
|
-
if (cid
|
262
|
+
if (cid == slot->cid) {
|
263
263
|
pending = atomic_load(&slot->pending);
|
264
264
|
break;
|
265
265
|
}
|
@@ -276,7 +276,7 @@ cc_get_slot(CCache cc, uint64_t cid) {
|
|
276
276
|
|
277
277
|
pthread_mutex_lock(&cc->lock);
|
278
278
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
279
|
-
if (cid
|
279
|
+
if (cid == slot->cid) {
|
280
280
|
break;
|
281
281
|
}
|
282
282
|
}
|
@@ -292,7 +292,7 @@ cc_pending_inc(CCache cc, uint64_t cid) {
|
|
292
292
|
|
293
293
|
pthread_mutex_lock(&cc->lock);
|
294
294
|
for (slot = *bucket; NULL != slot; slot = slot->next) {
|
295
|
-
if (cid
|
295
|
+
if (cid == slot->cid) {
|
296
296
|
atomic_fetch_add(&slot->pending, 1);
|
297
297
|
break;
|
298
298
|
}
|
data/ext/agoo/debug.c
CHANGED
@@ -155,6 +155,23 @@ debug_add(void *ptr, const char *type, const char *file, int line) {
|
|
155
155
|
pthread_mutex_unlock(&lock);
|
156
156
|
}
|
157
157
|
|
158
|
+
void
|
159
|
+
debug_update(void *orig, void *ptr, const char *type, const char *file, int line) {
|
160
|
+
Rec r;
|
161
|
+
|
162
|
+
pthread_mutex_lock(&lock);
|
163
|
+
for (r = recs; NULL != r; r = r->next) {
|
164
|
+
if (orig == r->ptr) {
|
165
|
+
r->ptr = ptr;
|
166
|
+
break;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
pthread_mutex_unlock(&lock);
|
170
|
+
if (NULL == r) {
|
171
|
+
printf("Realloc at %s:%d (%p) not allocated.\n", file, line, orig);
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
158
175
|
void
|
159
176
|
debug_del(void *ptr, const char *file, int line) {
|
160
177
|
Rec r = NULL;
|
data/ext/agoo/debug.h
CHANGED
@@ -7,9 +7,11 @@
|
|
7
7
|
|
8
8
|
#ifdef MEM_DEBUG
|
9
9
|
#define DEBUG_ALLOC(var, ptr) { atomic_fetch_add(&var, 1); debug_add(ptr, #var, __FILE__, __LINE__); }
|
10
|
+
#define DEBUG_REALLOC(var, orig, ptr) { debug_update(orig, ptr, #var, __FILE__, __LINE__); }
|
10
11
|
#define DEBUG_FREE(var, ptr) { atomic_fetch_sub(&var, 1); debug_del(ptr, __FILE__, __LINE__); }
|
11
12
|
#else
|
12
13
|
#define DEBUG_ALLOC(var, ptr) { }
|
14
|
+
#define DEBUG_REALLOC(var, orig, ptr) { }
|
13
15
|
#define DEBUG_FREE(var, ptr) { }
|
14
16
|
#endif
|
15
17
|
|
@@ -41,6 +43,7 @@ extern atomic_int mem_text;
|
|
41
43
|
extern atomic_int mem_to_s;
|
42
44
|
|
43
45
|
extern void debug_add(void *ptr, const char *type, const char *file, int line);
|
46
|
+
extern void debug_update(void *orig, void *ptr, const char *type, const char *file, int line);
|
44
47
|
extern void debug_del(void *ptr, const char *file, int line);
|
45
48
|
extern void debug_report();
|
46
49
|
extern void debug_rreport(); // when called from ruby
|
data/ext/agoo/text.c
CHANGED
@@ -46,7 +46,7 @@ text_ref(Text t) {
|
|
46
46
|
void
|
47
47
|
text_release(Text t) {
|
48
48
|
if (1 >= atomic_fetch_sub(&t->ref_cnt, 1)) {
|
49
|
-
DEBUG_FREE(mem_text, t)
|
49
|
+
DEBUG_FREE(mem_text, t);
|
50
50
|
free(t);
|
51
51
|
}
|
52
52
|
}
|
@@ -57,12 +57,14 @@ text_append(Text t, const char *s, int len) {
|
|
57
57
|
len = (int)strlen(s);
|
58
58
|
}
|
59
59
|
if (t->alen <= t->len + len) {
|
60
|
-
long new_len = t->alen + t->alen / 2;
|
60
|
+
long new_len = t->alen + len + t->alen / 2;
|
61
61
|
size_t size = sizeof(struct _Text) - TEXT_MIN_SIZE + new_len + 1;
|
62
|
-
|
62
|
+
Text t0 = t;
|
63
|
+
|
63
64
|
if (NULL == (t = (Text)realloc(t, size))) {
|
64
65
|
return NULL;
|
65
66
|
}
|
67
|
+
DEBUG_REALLOC(mem_text, t0, t);
|
66
68
|
t->alen = new_len;
|
67
69
|
}
|
68
70
|
memcpy(t->text + t->len, s, len);
|
@@ -78,7 +80,7 @@ text_prepend(Text t, const char *s, int len) {
|
|
78
80
|
len = (int)strlen(s);
|
79
81
|
}
|
80
82
|
if (t->alen <= t->len + len) {
|
81
|
-
long new_len = t->alen + t->alen / 2;
|
83
|
+
long new_len = t->alen + len + t->alen / 2;
|
82
84
|
size_t size = sizeof(struct _Text) - TEXT_MIN_SIZE + new_len + 1;
|
83
85
|
|
84
86
|
if (NULL == (t = (Text)realloc(t, size))) {
|
data/lib/agoo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -137,12 +137,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
requirements:
|
138
138
|
- Linux or macOS
|
139
139
|
rubyforge_project: agoo
|
140
|
-
rubygems_version: 2.7.
|
140
|
+
rubygems_version: 2.7.3
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: An HTTP server
|
144
144
|
test_files:
|
145
|
-
- test/rack_handler_test.rb
|
146
145
|
- test/base_handler_test.rb
|
147
|
-
- test/static_test.rb
|
148
146
|
- test/log_test.rb
|
147
|
+
- test/rack_handler_test.rb
|
148
|
+
- test/static_test.rb
|