uringmachine 0.5 → 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/TODO.md +4 -0
- data/examples/bm_http_parse.rb +149 -0
- data/examples/bm_queue.rb +111 -0
- data/examples/bm_sqlite.rb +89 -0
- data/examples/http_server.rb +1 -1
- data/examples/pg.rb +85 -0
- data/examples/stream.rb +85 -0
- data/ext/um/extconf.rb +57 -0
- data/ext/um/um.c +75 -4
- data/ext/um/um.h +29 -7
- data/ext/um/um_async_op.c +40 -0
- data/ext/um/um_async_op_class.c +136 -0
- data/ext/um/um_class.c +45 -31
- data/ext/um/um_const.c +145 -9
- data/ext/um/um_ext.c +4 -0
- data/ext/um/um_op.c +5 -2
- data/ext/um/um_ssl.c +850 -0
- data/ext/um/um_ssl.h +22 -0
- data/ext/um/um_ssl_class.c +138 -0
- data/lib/uringmachine/actor.rb +52 -0
- data/lib/uringmachine/ssl/context_builder.rb +96 -0
- data/lib/uringmachine/ssl.rb +394 -0
- data/lib/uringmachine/version.rb +1 -1
- data/lib/uringmachine.rb +10 -2
- data/test/helper.rb +6 -0
- data/test/test_actor.rb +63 -0
- data/test/test_async_op.rb +119 -0
- data/test/test_ssl.rb +155 -0
- data/test/test_um.rb +71 -2
- data/uringmachine.gemspec +4 -3
- metadata +39 -13
data/ext/um/um_const.c
CHANGED
@@ -16,6 +16,19 @@
|
|
16
16
|
#define DEF_CONST_INT(mod, v) rb_define_const(mod, #v, INT2NUM(v))
|
17
17
|
|
18
18
|
void um_define_net_constants(VALUE mod) {
|
19
|
+
DEF_CONST_INT(mod, MSG_CONFIRM);
|
20
|
+
DEF_CONST_INT(mod, MSG_DONTROUTE);
|
21
|
+
DEF_CONST_INT(mod, MSG_DONTWAIT);
|
22
|
+
DEF_CONST_INT(mod, MSG_EOR);
|
23
|
+
DEF_CONST_INT(mod, MSG_ERRQUEUE);
|
24
|
+
DEF_CONST_INT(mod, MSG_FASTOPEN);
|
25
|
+
DEF_CONST_INT(mod, MSG_MORE);
|
26
|
+
DEF_CONST_INT(mod, MSG_NOSIGNAL);
|
27
|
+
DEF_CONST_INT(mod, MSG_OOB);
|
28
|
+
DEF_CONST_INT(mod, MSG_PEEK);
|
29
|
+
DEF_CONST_INT(mod, MSG_TRUNC);
|
30
|
+
DEF_CONST_INT(mod, MSG_WAITALL);
|
31
|
+
|
19
32
|
DEF_CONST_INT(mod, O_APPEND);
|
20
33
|
DEF_CONST_INT(mod, O_CLOEXEC);
|
21
34
|
DEF_CONST_INT(mod, O_CREAT);
|
@@ -38,7 +51,6 @@ void um_define_net_constants(VALUE mod) {
|
|
38
51
|
DEF_CONST_INT(mod, WCONTINUED);
|
39
52
|
DEF_CONST_INT(mod, WEXITED);
|
40
53
|
DEF_CONST_INT(mod, WSTOPPED);
|
41
|
-
DEF_CONST_INT(mod, WCONTINUED);
|
42
54
|
DEF_CONST_INT(mod, WNOWAIT);
|
43
55
|
|
44
56
|
DEF_CONST_INT(mod, SOCK_STREAM);
|
@@ -64,13 +76,6 @@ void um_define_net_constants(VALUE mod) {
|
|
64
76
|
DEF_CONST_INT(mod, AF_MAX);
|
65
77
|
DEF_CONST_INT(mod, PF_MAX);
|
66
78
|
|
67
|
-
DEF_CONST_INT(mod, MSG_OOB);
|
68
|
-
DEF_CONST_INT(mod, MSG_PEEK);
|
69
|
-
DEF_CONST_INT(mod, MSG_DONTROUTE);
|
70
|
-
DEF_CONST_INT(mod, MSG_WAITALL);
|
71
|
-
DEF_CONST_INT(mod, MSG_DONTWAIT);
|
72
|
-
DEF_CONST_INT(mod, MSG_MORE);
|
73
|
-
|
74
79
|
DEF_CONST_INT(mod, SOL_SOCKET);
|
75
80
|
DEF_CONST_INT(mod, SOL_IP);
|
76
81
|
|
@@ -146,7 +151,7 @@ void um_define_net_constants(VALUE mod) {
|
|
146
151
|
DEF_CONST_INT(mod, TCP_WINDOW_CLAMP);
|
147
152
|
DEF_CONST_INT(mod, TCP_FASTOPEN);
|
148
153
|
DEF_CONST_INT(mod, TCP_CONGESTION);
|
149
|
-
DEF_CONST_INT(mod, TCP_COOKIE_TRANSACTIONS);
|
154
|
+
// DEF_CONST_INT(mod, TCP_COOKIE_TRANSACTIONS);
|
150
155
|
DEF_CONST_INT(mod, TCP_QUEUE_SEQ);
|
151
156
|
DEF_CONST_INT(mod, TCP_REPAIR);
|
152
157
|
DEF_CONST_INT(mod, TCP_REPAIR_OPTIONS);
|
@@ -210,4 +215,135 @@ void um_define_net_constants(VALUE mod) {
|
|
210
215
|
DEF_CONST_INT(mod, IF_NAMESIZE);
|
211
216
|
|
212
217
|
DEF_CONST_INT(mod, SOMAXCONN);
|
218
|
+
|
219
|
+
DEF_CONST_INT(mod, EPERM);
|
220
|
+
DEF_CONST_INT(mod, ENOENT);
|
221
|
+
DEF_CONST_INT(mod, ESRCH);
|
222
|
+
DEF_CONST_INT(mod, EINTR);
|
223
|
+
DEF_CONST_INT(mod, EIO);
|
224
|
+
DEF_CONST_INT(mod, ENXIO);
|
225
|
+
DEF_CONST_INT(mod, E2BIG);
|
226
|
+
DEF_CONST_INT(mod, ENOEXEC);
|
227
|
+
DEF_CONST_INT(mod, EBADF);
|
228
|
+
DEF_CONST_INT(mod, ECHILD);
|
229
|
+
DEF_CONST_INT(mod, EAGAIN);
|
230
|
+
DEF_CONST_INT(mod, ENOMEM);
|
231
|
+
DEF_CONST_INT(mod, EACCES);
|
232
|
+
DEF_CONST_INT(mod, EFAULT);
|
233
|
+
DEF_CONST_INT(mod, ENOTBLK);
|
234
|
+
DEF_CONST_INT(mod, EBUSY);
|
235
|
+
DEF_CONST_INT(mod, EEXIST);
|
236
|
+
DEF_CONST_INT(mod, EXDEV);
|
237
|
+
DEF_CONST_INT(mod, ENODEV);
|
238
|
+
DEF_CONST_INT(mod, ENOTDIR);
|
239
|
+
DEF_CONST_INT(mod, EISDIR);
|
240
|
+
DEF_CONST_INT(mod, EINVAL);
|
241
|
+
DEF_CONST_INT(mod, ENFILE);
|
242
|
+
DEF_CONST_INT(mod, EMFILE);
|
243
|
+
DEF_CONST_INT(mod, ENOTTY);
|
244
|
+
DEF_CONST_INT(mod, ETXTBSY);
|
245
|
+
DEF_CONST_INT(mod, EFBIG);
|
246
|
+
DEF_CONST_INT(mod, ENOSPC);
|
247
|
+
DEF_CONST_INT(mod, ESPIPE);
|
248
|
+
DEF_CONST_INT(mod, EROFS);
|
249
|
+
DEF_CONST_INT(mod, EMLINK);
|
250
|
+
DEF_CONST_INT(mod, EPIPE);
|
251
|
+
DEF_CONST_INT(mod, EDOM);
|
252
|
+
DEF_CONST_INT(mod, ERANGE);
|
253
|
+
DEF_CONST_INT(mod, EDEADLK);
|
254
|
+
DEF_CONST_INT(mod, ENAMETOOLONG);
|
255
|
+
DEF_CONST_INT(mod, ENOLCK);
|
256
|
+
DEF_CONST_INT(mod, ENOSYS);
|
257
|
+
DEF_CONST_INT(mod, ENOTEMPTY);
|
258
|
+
DEF_CONST_INT(mod, ELOOP);
|
259
|
+
DEF_CONST_INT(mod, ENOMSG);
|
260
|
+
DEF_CONST_INT(mod, EIDRM);
|
261
|
+
DEF_CONST_INT(mod, ECHRNG);
|
262
|
+
DEF_CONST_INT(mod, EL2NSYNC);
|
263
|
+
DEF_CONST_INT(mod, EL3HLT);
|
264
|
+
DEF_CONST_INT(mod, EL3RST);
|
265
|
+
DEF_CONST_INT(mod, ELNRNG);
|
266
|
+
DEF_CONST_INT(mod, EUNATCH);
|
267
|
+
DEF_CONST_INT(mod, ENOCSI);
|
268
|
+
DEF_CONST_INT(mod, EL2HLT);
|
269
|
+
DEF_CONST_INT(mod, EBADE);
|
270
|
+
DEF_CONST_INT(mod, EBADR);
|
271
|
+
DEF_CONST_INT(mod, EXFULL);
|
272
|
+
DEF_CONST_INT(mod, ENOANO);
|
273
|
+
DEF_CONST_INT(mod, EBADRQC);
|
274
|
+
DEF_CONST_INT(mod, EBADSLT);
|
275
|
+
DEF_CONST_INT(mod, EBFONT);
|
276
|
+
DEF_CONST_INT(mod, ENOSTR);
|
277
|
+
DEF_CONST_INT(mod, ENODATA);
|
278
|
+
DEF_CONST_INT(mod, ETIME);
|
279
|
+
DEF_CONST_INT(mod, ENOSR);
|
280
|
+
DEF_CONST_INT(mod, ENONET);
|
281
|
+
DEF_CONST_INT(mod, ENOPKG);
|
282
|
+
DEF_CONST_INT(mod, EREMOTE);
|
283
|
+
DEF_CONST_INT(mod, ENOLINK);
|
284
|
+
DEF_CONST_INT(mod, EADV);
|
285
|
+
DEF_CONST_INT(mod, ESRMNT);
|
286
|
+
DEF_CONST_INT(mod, ECOMM);
|
287
|
+
DEF_CONST_INT(mod, EPROTO);
|
288
|
+
DEF_CONST_INT(mod, EMULTIHOP);
|
289
|
+
DEF_CONST_INT(mod, EDOTDOT);
|
290
|
+
DEF_CONST_INT(mod, EBADMSG);
|
291
|
+
DEF_CONST_INT(mod, EOVERFLOW);
|
292
|
+
DEF_CONST_INT(mod, ENOTUNIQ);
|
293
|
+
DEF_CONST_INT(mod, EBADFD);
|
294
|
+
DEF_CONST_INT(mod, EREMCHG);
|
295
|
+
DEF_CONST_INT(mod, ELIBACC);
|
296
|
+
DEF_CONST_INT(mod, ELIBBAD);
|
297
|
+
DEF_CONST_INT(mod, ELIBSCN);
|
298
|
+
DEF_CONST_INT(mod, ELIBMAX);
|
299
|
+
DEF_CONST_INT(mod, ELIBEXEC);
|
300
|
+
DEF_CONST_INT(mod, EILSEQ);
|
301
|
+
DEF_CONST_INT(mod, ERESTART);
|
302
|
+
DEF_CONST_INT(mod, ESTRPIPE);
|
303
|
+
DEF_CONST_INT(mod, EUSERS);
|
304
|
+
DEF_CONST_INT(mod, ENOTSOCK);
|
305
|
+
DEF_CONST_INT(mod, EDESTADDRREQ);
|
306
|
+
DEF_CONST_INT(mod, EMSGSIZE);
|
307
|
+
DEF_CONST_INT(mod, EPROTOTYPE);
|
308
|
+
DEF_CONST_INT(mod, ENOPROTOOPT);
|
309
|
+
DEF_CONST_INT(mod, EPROTONOSUPPORT);
|
310
|
+
DEF_CONST_INT(mod, ESOCKTNOSUPPORT);
|
311
|
+
DEF_CONST_INT(mod, EOPNOTSUPP);
|
312
|
+
DEF_CONST_INT(mod, EPFNOSUPPORT);
|
313
|
+
DEF_CONST_INT(mod, EAFNOSUPPORT);
|
314
|
+
DEF_CONST_INT(mod, EADDRINUSE);
|
315
|
+
DEF_CONST_INT(mod, EADDRNOTAVAIL);
|
316
|
+
DEF_CONST_INT(mod, ENETDOWN);
|
317
|
+
DEF_CONST_INT(mod, ENETUNREACH);
|
318
|
+
DEF_CONST_INT(mod, ENETRESET);
|
319
|
+
DEF_CONST_INT(mod, ECONNABORTED);
|
320
|
+
DEF_CONST_INT(mod, ECONNRESET);
|
321
|
+
DEF_CONST_INT(mod, ENOBUFS);
|
322
|
+
DEF_CONST_INT(mod, EISCONN);
|
323
|
+
DEF_CONST_INT(mod, ENOTCONN);
|
324
|
+
DEF_CONST_INT(mod, ESHUTDOWN);
|
325
|
+
DEF_CONST_INT(mod, ETOOMANYREFS);
|
326
|
+
DEF_CONST_INT(mod, ETIMEDOUT);
|
327
|
+
DEF_CONST_INT(mod, ECONNREFUSED);
|
328
|
+
DEF_CONST_INT(mod, EHOSTDOWN);
|
329
|
+
DEF_CONST_INT(mod, EHOSTUNREACH);
|
330
|
+
DEF_CONST_INT(mod, EALREADY);
|
331
|
+
DEF_CONST_INT(mod, EINPROGRESS);
|
332
|
+
DEF_CONST_INT(mod, ESTALE);
|
333
|
+
DEF_CONST_INT(mod, EUCLEAN);
|
334
|
+
DEF_CONST_INT(mod, ENOTNAM);
|
335
|
+
DEF_CONST_INT(mod, ENAVAIL);
|
336
|
+
DEF_CONST_INT(mod, EISNAM);
|
337
|
+
DEF_CONST_INT(mod, EREMOTEIO);
|
338
|
+
DEF_CONST_INT(mod, EDQUOT);
|
339
|
+
DEF_CONST_INT(mod, ENOMEDIUM);
|
340
|
+
DEF_CONST_INT(mod, EMEDIUMTYPE);
|
341
|
+
DEF_CONST_INT(mod, ECANCELED);
|
342
|
+
DEF_CONST_INT(mod, ENOKEY);
|
343
|
+
DEF_CONST_INT(mod, EKEYEXPIRED);
|
344
|
+
DEF_CONST_INT(mod, EKEYREVOKED);
|
345
|
+
DEF_CONST_INT(mod, EKEYREJECTED);
|
346
|
+
DEF_CONST_INT(mod, EOWNERDEAD);
|
347
|
+
DEF_CONST_INT(mod, ENOTRECOVERABLE);
|
348
|
+
|
213
349
|
}
|
data/ext/um/um_ext.c
CHANGED
data/ext/um/um_op.c
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
inline void um_op_clear(struct um *machine, struct um_op *op) {
|
4
4
|
memset(op, 0, sizeof(struct um_op));
|
5
|
-
|
6
|
-
|
5
|
+
op->fiber = Qnil;
|
6
|
+
op->value = Qnil;
|
7
|
+
op->async_op = Qnil;
|
7
8
|
}
|
8
9
|
|
9
10
|
inline void um_op_transient_add(struct um *machine, struct um_op *op) {
|
@@ -50,6 +51,7 @@ inline void um_op_list_mark(struct um *machine, struct um_op *head) {
|
|
50
51
|
struct um_op *next = head->next;
|
51
52
|
rb_gc_mark_movable(head->fiber);
|
52
53
|
rb_gc_mark_movable(head->value);
|
54
|
+
rb_gc_mark_movable(head->async_op);
|
53
55
|
head = next;
|
54
56
|
}
|
55
57
|
}
|
@@ -59,6 +61,7 @@ inline void um_op_list_compact(struct um *machine, struct um_op *head) {
|
|
59
61
|
struct um_op *next = head->next;
|
60
62
|
head->fiber = rb_gc_location(head->fiber);
|
61
63
|
head->value = rb_gc_location(head->value);
|
64
|
+
head->async_op = rb_gc_location(head->async_op);
|
62
65
|
head = next;
|
63
66
|
}
|
64
67
|
}
|