agoo 2.11.0 → 2.11.1
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 +7 -0
- data/ext/agoo/con.c +25 -13
- data/ext/agoo/ready.c +15 -10
- data/lib/agoo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b7919a52d201024eefc3480e4f64e28587b124b402d41dfd4cf9cc2108a01a6
|
4
|
+
data.tar.gz: a7d185258d848b7887b50dccac072eed8660817a099a210d279d52812ade3263
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 434a205f05f234cb2eec6212e33947cecbc8773c47c6c77e0e0c17aab87d22b6406cdfd3750fbb9388f1ca5972cb883a95b7b3c3565c5a50b09cb4cd6a314079
|
7
|
+
data.tar.gz: 9decdf78bb95013eaedd1b9ee594f7206fdaca20b1e9c9944fc87bbd61a4fcb376fa357d2b3c83f0c1d3f9eb38e7bd6661e58d7a790d2f8b7d57ad3cd566e2ca
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ All changes to the Agoo gem are documented here. Releases follow semantic versio
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [2.11.1] - [2019-09-22]
|
8
|
+
|
9
|
+
Race fix
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
- A race condion occurred with a slow Ruby response and a connection close. Fixed.
|
13
|
+
|
7
14
|
## [2.11.0] - [2019-09-15]
|
8
15
|
|
9
16
|
TLS using OpenSSL
|
data/ext/agoo/con.c
CHANGED
@@ -75,10 +75,7 @@ agoo_con_create(agooErr err, int sock, uint64_t id, agooBind b) {
|
|
75
75
|
|
76
76
|
void
|
77
77
|
agoo_con_destroy(agooCon c) {
|
78
|
-
agooRes res;
|
79
|
-
|
80
78
|
atomic_fetch_sub(&agoo_server.con_cnt, 1);
|
81
|
-
|
82
79
|
if (AGOO_CON_WS == c->bind->kind || AGOO_CON_SSE == c->bind->kind) {
|
83
80
|
agoo_ws_req_close(c);
|
84
81
|
}
|
@@ -106,6 +103,8 @@ agoo_con_destroy(agooCon c) {
|
|
106
103
|
}
|
107
104
|
agoo_log_cat(&agoo_con_cat, "Connection %llu closed.", (unsigned long long)c->id);
|
108
105
|
|
106
|
+
agooRes res;
|
107
|
+
|
109
108
|
while (NULL != (res = c->res_head)) {
|
110
109
|
c->res_head = res->next;
|
111
110
|
AGOO_FREE(res);
|
@@ -520,6 +519,7 @@ agoo_con_http_read(agooCon c) {
|
|
520
519
|
return false;
|
521
520
|
} else {
|
522
521
|
con_ssl_error(c, __FILE__, __LINE__);
|
522
|
+
c->dead = true;
|
523
523
|
return true;
|
524
524
|
}
|
525
525
|
}
|
@@ -544,6 +544,7 @@ agoo_con_http_read(agooCon c) {
|
|
544
544
|
agoo_log_cat(&agoo_warn_cat, "Failed to read request. %s.", strerror(errno));
|
545
545
|
}
|
546
546
|
}
|
547
|
+
c->dead = true;
|
547
548
|
return true;
|
548
549
|
}
|
549
550
|
c->bcnt += cnt;
|
@@ -553,7 +554,7 @@ agoo_con_http_read(agooCon c) {
|
|
553
554
|
|
554
555
|
switch (con_header_read(c, &mlen)) {
|
555
556
|
case HEAD_AGAIN:
|
556
|
-
// Try again the next time. Didn't read enough
|
557
|
+
// Try again the next time. Didn't read enough.
|
557
558
|
return false;
|
558
559
|
case HEAD_OK:
|
559
560
|
// req was created
|
@@ -665,6 +666,8 @@ agoo_con_http_write(agooCon c) {
|
|
665
666
|
return true;
|
666
667
|
}
|
667
668
|
con_ssl_error(c, __FILE__, __LINE__);
|
669
|
+
c->dead = true;
|
670
|
+
|
668
671
|
return false;
|
669
672
|
}
|
670
673
|
#else
|
@@ -677,6 +680,7 @@ agoo_con_http_write(agooCon c) {
|
|
677
680
|
return true;
|
678
681
|
}
|
679
682
|
agoo_log_cat(&agoo_error_cat, "Socket error @ %llu.", (unsigned long long)c->id);
|
683
|
+
c->dead = true;
|
680
684
|
|
681
685
|
return false;
|
682
686
|
}
|
@@ -1127,7 +1131,7 @@ static agooReadyIO
|
|
1127
1131
|
con_ready_io(void *ctx) {
|
1128
1132
|
agooCon c = (agooCon)ctx;
|
1129
1133
|
|
1130
|
-
if (NULL != c->bind) {
|
1134
|
+
if (NULL != c->bind && !c->dead && 0 != c->sock) {
|
1131
1135
|
switch (c->bind->events(c)) {
|
1132
1136
|
case POLLIN: return AGOO_READY_IN;
|
1133
1137
|
case POLLOUT: return AGOO_READY_OUT;
|
@@ -1138,33 +1142,32 @@ con_ready_io(void *ctx) {
|
|
1138
1142
|
return AGOO_READY_NONE;
|
1139
1143
|
}
|
1140
1144
|
|
1145
|
+
// Ready to close check. True if ready to close.
|
1141
1146
|
static bool
|
1142
1147
|
con_ready_check(void *ctx, double now) {
|
1143
1148
|
agooCon c = (agooCon)ctx;
|
1144
1149
|
|
1145
1150
|
if (c->dead || 0 == c->sock) {
|
1146
1151
|
if (remove_dead_res(c)) {
|
1147
|
-
return
|
1152
|
+
return true;
|
1148
1153
|
}
|
1149
1154
|
} else if (0.0 == c->timeout || now < c->timeout) {
|
1150
|
-
return
|
1155
|
+
return false;
|
1151
1156
|
} else if (c->closing) {
|
1152
1157
|
if (remove_dead_res(c)) {
|
1153
|
-
return
|
1158
|
+
return true;
|
1154
1159
|
}
|
1155
1160
|
} else if (AGOO_CON_WS == c->bind->kind || AGOO_CON_SSE == c->bind->kind) {
|
1156
1161
|
c->timeout = dtime() + CON_TIMEOUT;
|
1157
1162
|
if (AGOO_CON_WS == c->bind->kind) {
|
1158
1163
|
agoo_ws_ping(c);
|
1159
1164
|
}
|
1160
|
-
return
|
1165
|
+
return false;
|
1161
1166
|
} else {
|
1162
1167
|
c->closing = true;
|
1163
1168
|
c->timeout = now + 0.5;
|
1164
|
-
|
1165
|
-
return true;
|
1166
1169
|
}
|
1167
|
-
return
|
1170
|
+
return false;
|
1168
1171
|
}
|
1169
1172
|
|
1170
1173
|
static bool
|
@@ -1178,6 +1181,8 @@ con_ready_read(agooReady ready, void *ctx) {
|
|
1178
1181
|
} else {
|
1179
1182
|
return true; // not an error, just ignore
|
1180
1183
|
}
|
1184
|
+
c->dead = true;
|
1185
|
+
|
1181
1186
|
return false;
|
1182
1187
|
}
|
1183
1188
|
|
@@ -1208,6 +1213,8 @@ con_ready_write(void *ctx) {
|
|
1208
1213
|
}
|
1209
1214
|
}
|
1210
1215
|
}
|
1216
|
+
c->dead = true;
|
1217
|
+
|
1211
1218
|
return false;
|
1212
1219
|
}
|
1213
1220
|
|
@@ -1216,12 +1223,17 @@ con_ready_destroy(void *ctx) {
|
|
1216
1223
|
agoo_con_destroy((agooCon)ctx);
|
1217
1224
|
}
|
1218
1225
|
|
1226
|
+
static void
|
1227
|
+
con_ready_error(void *ctx) {
|
1228
|
+
((agooCon)ctx)->dead = true;
|
1229
|
+
}
|
1230
|
+
|
1219
1231
|
static struct _agooHandler con_handler = {
|
1220
1232
|
.io = con_ready_io,
|
1221
1233
|
.check = con_ready_check,
|
1222
1234
|
.read = con_ready_read,
|
1223
1235
|
.write = con_ready_write,
|
1224
|
-
.error =
|
1236
|
+
.error = con_ready_error,
|
1225
1237
|
.destroy = con_ready_destroy,
|
1226
1238
|
};
|
1227
1239
|
|
data/ext/agoo/ready.c
CHANGED
@@ -201,6 +201,13 @@ ready_remove(agooReady ready, Link link) {
|
|
201
201
|
ready->lcnt--;
|
202
202
|
}
|
203
203
|
|
204
|
+
static void
|
205
|
+
ready_check_remove(agooReady ready, Link link) {
|
206
|
+
if (NULL == link->handler->check || link->handler->check(link->ctx, 0.0)) {
|
207
|
+
ready_remove(ready, link);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
204
211
|
int
|
205
212
|
agoo_ready_go(agooErr err, agooReady ready) {
|
206
213
|
double now;
|
@@ -250,13 +257,13 @@ agoo_ready_go(agooErr err, agooReady ready) {
|
|
250
257
|
link = (Link)ep->data.ptr;
|
251
258
|
if (0 != (ep->events & EPOLLIN) && NULL != link->handler->read) {
|
252
259
|
if (!link->handler->read(ready, link->ctx)) {
|
253
|
-
|
260
|
+
ready_check_remove(ready, link);
|
254
261
|
continue;
|
255
262
|
}
|
256
263
|
}
|
257
264
|
if (0 != (ep->events & EPOLLOUT && NULL != link->handler->write)) {
|
258
265
|
if (!link->handler->write(link->ctx)) {
|
259
|
-
|
266
|
+
ready_check_remove(ready, link);
|
260
267
|
continue;
|
261
268
|
}
|
262
269
|
}
|
@@ -264,7 +271,7 @@ agoo_ready_go(agooErr err, agooReady ready) {
|
|
264
271
|
if (NULL != link->handler->error) {
|
265
272
|
link->handler->error(link->ctx);
|
266
273
|
}
|
267
|
-
|
274
|
+
ready_check_remove(ready, link);
|
268
275
|
continue;
|
269
276
|
}
|
270
277
|
}
|
@@ -312,13 +319,13 @@ agoo_ready_go(agooErr err, agooReady ready) {
|
|
312
319
|
pp = link->pp;
|
313
320
|
if (0 != (pp->revents & POLLIN) && NULL != link->handler->read) {
|
314
321
|
if (!link->handler->read(ready, link->ctx)) {
|
315
|
-
|
322
|
+
ready_check_remove(ready, link);
|
316
323
|
continue;
|
317
324
|
}
|
318
325
|
}
|
319
326
|
if (0 != (pp->revents & POLLOUT && NULL != link->handler->write)) {
|
320
327
|
if (!link->handler->write(link->ctx)) {
|
321
|
-
|
328
|
+
ready_check_remove(ready, link);
|
322
329
|
continue;
|
323
330
|
}
|
324
331
|
}
|
@@ -326,7 +333,7 @@ agoo_ready_go(agooErr err, agooReady ready) {
|
|
326
333
|
if (NULL != link->handler->error) {
|
327
334
|
link->handler->error(link->ctx);
|
328
335
|
}
|
329
|
-
|
336
|
+
ready_check_remove(ready, link);
|
330
337
|
continue;
|
331
338
|
}
|
332
339
|
}
|
@@ -337,10 +344,8 @@ agoo_ready_go(agooErr err, agooReady ready) {
|
|
337
344
|
if (ready->next_check <= now) {
|
338
345
|
for (link = ready->links; NULL != link; link = next) {
|
339
346
|
next = link->next;
|
340
|
-
if (NULL != link->handler->check) {
|
341
|
-
|
342
|
-
ready_remove(ready, link);
|
343
|
-
}
|
347
|
+
if (NULL != link->handler->check && link->handler->check(link->ctx, now)) {
|
348
|
+
ready_remove(ready, link);
|
344
349
|
}
|
345
350
|
}
|
346
351
|
ready->next_check = dtime() + CHECK_FREQ;
|
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.11.
|
4
|
+
version: 2.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ohler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|