polyphony 0.82 → 0.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/ext/polyphony/backend_common.c +15 -10
- data/ext/polyphony/backend_common.h +5 -4
- data/ext/polyphony/backend_io_uring.c +86 -151
- data/ext/polyphony/backend_libev.c +103 -159
- data/ext/polyphony/extconf.rb +3 -1
- data/ext/polyphony/io_extensions.c +440 -0
- data/ext/polyphony/pipe.c +109 -0
- data/ext/polyphony/polyphony.h +5 -0
- data/ext/polyphony/polyphony_ext.c +7 -2
- data/ext/polyphony/zlib_conf.rb +119 -0
- data/lib/polyphony/extensions/io.rb +10 -2
- data/lib/polyphony/extensions/pipe.rb +167 -0
- data/lib/polyphony/extensions.rb +1 -0
- data/lib/polyphony/version.rb +1 -1
- data/lib/polyphony.rb +4 -0
- data/test/helper.rb +4 -0
- data/test/test_backend.rb +3 -48
- data/test/test_global_api.rb +23 -23
- data/test/test_io.rb +332 -0
- data/test/test_pipe.rb +41 -0
- data/test/test_process_supervision.rb +1 -1
- data/test/test_socket.rb +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1e0c71b9d91e674e4ce004da08cdf6535f56e48b063b63538685eb781654df6
|
4
|
+
data.tar.gz: 58bf12edd0751ecc552ee01b6eb7042585061f7800f0dfa6fdc0990b87349982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c35e1c2756556db5bf11012b95c7e729d7ad43f52802c61fa5467d44a6460a2f30f840bc945347e83ed24d35e559b0ca4ac9d5657c9d0c805ffb44774765f867
|
7
|
+
data.tar.gz: 37c34a7c2cc0b3443c0f33908f40156c223eae233ca08f564a606a7bec5c8c68189b973e6fa40fd1534bb3c9f2f3985b52fcdd33c7ea9069ba21e32e7ebc1760
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.83 2022-03-10
|
2
|
+
|
3
|
+
- Implement `Polyphony::Pipe` class, `Polyphony.pipe` method (#83)
|
4
|
+
- Add `IO.splice`, `IO.splice_to_eof` (#82)
|
5
|
+
- Implement compression/decompression methods (#77)
|
6
|
+
|
1
7
|
## 0.82 2022-03-04
|
2
8
|
|
3
9
|
- Use `POLYPHONY_LIBEV` instead of `POLYPHONY_USE_LIBEV` environment variable
|
data/Gemfile.lock
CHANGED
@@ -340,33 +340,38 @@ VALUE Backend_sendv(VALUE self, VALUE io, VALUE ary, VALUE flags) {
|
|
340
340
|
}
|
341
341
|
}
|
342
342
|
|
343
|
-
inline void
|
343
|
+
inline void set_fd_blocking_mode(int fd, int blocking) {
|
344
344
|
int flags;
|
345
345
|
int is_nonblocking;
|
346
|
-
VALUE blocking_mode = rb_ivar_get(io, ID_ivar_blocking_mode);
|
347
|
-
if (blocking == blocking_mode) return;
|
348
|
-
|
349
|
-
rb_ivar_set(io, ID_ivar_blocking_mode, blocking);
|
350
346
|
|
351
347
|
#ifdef _WIN32
|
352
|
-
if (blocking
|
353
|
-
rb_w32_set_nonblock(fptr->fd);
|
348
|
+
if (!blocking) rb_w32_set_nonblock(fd);
|
354
349
|
#elif defined(F_GETFL)
|
355
|
-
flags = fcntl(
|
350
|
+
flags = fcntl(fd, F_GETFL);
|
356
351
|
if (flags == -1) return;
|
357
352
|
is_nonblocking = flags & O_NONBLOCK;
|
358
353
|
|
359
|
-
if (blocking
|
354
|
+
if (blocking) {
|
360
355
|
if (!is_nonblocking) return;
|
361
356
|
flags &= ~O_NONBLOCK;
|
362
357
|
} else {
|
363
358
|
if (is_nonblocking) return;
|
364
359
|
flags |= O_NONBLOCK;
|
365
360
|
}
|
366
|
-
fcntl(
|
361
|
+
fcntl(fd, F_SETFL, flags);
|
367
362
|
#endif
|
368
363
|
}
|
369
364
|
|
365
|
+
inline void io_verify_blocking_mode(rb_io_t *fptr, VALUE io, VALUE blocking) {
|
366
|
+
int flags;
|
367
|
+
int is_nonblocking;
|
368
|
+
VALUE blocking_mode = rb_ivar_get(io, ID_ivar_blocking_mode);
|
369
|
+
if (blocking == blocking_mode) return;
|
370
|
+
|
371
|
+
rb_ivar_set(io, ID_ivar_blocking_mode, blocking);
|
372
|
+
set_fd_blocking_mode(fptr->fd, blocking == Qtrue);
|
373
|
+
}
|
374
|
+
|
370
375
|
inline void backend_run_idle_tasks(struct Backend_base *base) {
|
371
376
|
double now;
|
372
377
|
|
@@ -58,12 +58,12 @@ struct backend_stats backend_base_stats(struct Backend_base *base);
|
|
58
58
|
// raw buffers
|
59
59
|
|
60
60
|
struct raw_buffer {
|
61
|
-
char *ptr;
|
61
|
+
unsigned char *ptr;
|
62
62
|
int len;
|
63
63
|
};
|
64
64
|
|
65
65
|
struct io_buffer {
|
66
|
-
char *ptr;
|
66
|
+
unsigned char *ptr;
|
67
67
|
int len;
|
68
68
|
int raw;
|
69
69
|
};
|
@@ -114,14 +114,14 @@ VALUE backend_snooze(struct Backend_base *backend);
|
|
114
114
|
|
115
115
|
#define READ_LOOP_YIELD_STR() { \
|
116
116
|
io_set_read_length(str, total, shrinkable); \
|
117
|
-
io_enc_str(str, fptr); \
|
117
|
+
if (fptr) io_enc_str(str, fptr); \
|
118
118
|
rb_yield(str); \
|
119
119
|
READ_LOOP_PREPARE_STR(); \
|
120
120
|
}
|
121
121
|
|
122
122
|
#define READ_LOOP_PASS_STR_TO_RECEIVER(receiver, method_id) { \
|
123
123
|
io_set_read_length(str, total, shrinkable); \
|
124
|
-
io_enc_str(str, fptr); \
|
124
|
+
if (fptr) io_enc_str(str, fptr); \
|
125
125
|
rb_funcall_passing_block(receiver, method_id, 1, &str); \
|
126
126
|
READ_LOOP_PREPARE_STR(); \
|
127
127
|
}
|
@@ -136,6 +136,7 @@ VALUE Backend_sendv(VALUE self, VALUE io, VALUE ary, VALUE flags);
|
|
136
136
|
VALUE Backend_stats(VALUE self);
|
137
137
|
VALUE Backend_verify_blocking_mode(VALUE self, VALUE io, VALUE blocking);
|
138
138
|
void backend_run_idle_tasks(struct Backend_base *base);
|
139
|
+
void set_fd_blocking_mode(int fd, int blocking);
|
139
140
|
void io_verify_blocking_mode(rb_io_t *fptr, VALUE io, VALUE blocking);
|
140
141
|
void backend_setup_stats_symbols();
|
141
142
|
int backend_getaddrinfo(VALUE host, VALUE port, struct sockaddr **ai_addr);
|