rloop 0.2.1__tar.gz → 0.3.1__tar.gz

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.
Files changed (36) hide show
  1. rloop-0.3.1/Cargo.lock +220 -0
  2. {rloop-0.2.1 → rloop-0.3.1}/Cargo.toml +4 -8
  3. {rloop-0.2.1 → rloop-0.3.1}/PKG-INFO +4 -3
  4. {rloop-0.2.1 → rloop-0.3.1}/pyproject.toml +3 -2
  5. {rloop-0.2.1 → rloop-0.3.1}/src/event_loop.rs +8 -3
  6. {rloop-0.2.1 → rloop-0.3.1}/src/tcp.rs +53 -19
  7. rloop-0.2.1/Cargo.lock +0 -350
  8. {rloop-0.2.1 → rloop-0.3.1}/LICENSE +0 -0
  9. {rloop-0.2.1 → rloop-0.3.1}/README.md +0 -0
  10. {rloop-0.2.1 → rloop-0.3.1}/rloop/__init__.py +0 -0
  11. {rloop-0.2.1 → rloop-0.3.1}/rloop/_compat.py +0 -0
  12. {rloop-0.2.1 → rloop-0.3.1}/rloop/_rloop.pyi +0 -0
  13. {rloop-0.2.1 → rloop-0.3.1}/rloop/exc.py +0 -0
  14. {rloop-0.2.1 → rloop-0.3.1}/rloop/futures.py +0 -0
  15. {rloop-0.2.1 → rloop-0.3.1}/rloop/loop.py +0 -0
  16. {rloop-0.2.1 → rloop-0.3.1}/rloop/server.py +0 -0
  17. {rloop-0.2.1 → rloop-0.3.1}/rloop/subprocess.py +0 -0
  18. {rloop-0.2.1 → rloop-0.3.1}/rloop/transports.py +0 -0
  19. {rloop-0.2.1 → rloop-0.3.1}/rloop/utils.py +0 -0
  20. {rloop-0.2.1 → rloop-0.3.1}/src/handles.rs +0 -0
  21. {rloop-0.2.1 → rloop-0.3.1}/src/io.rs +0 -0
  22. {rloop-0.2.1 → rloop-0.3.1}/src/lib.rs +0 -0
  23. {rloop-0.2.1 → rloop-0.3.1}/src/log.rs +0 -0
  24. {rloop-0.2.1 → rloop-0.3.1}/src/py.rs +0 -0
  25. {rloop-0.2.1 → rloop-0.3.1}/src/server.rs +0 -0
  26. {rloop-0.2.1 → rloop-0.3.1}/src/sock.rs +0 -0
  27. {rloop-0.2.1 → rloop-0.3.1}/src/time.rs +0 -0
  28. {rloop-0.2.1 → rloop-0.3.1}/src/udp.rs +0 -0
  29. {rloop-0.2.1 → rloop-0.3.1}/src/utils.rs +0 -0
  30. {rloop-0.2.1 → rloop-0.3.1}/tests/conftest.py +0 -0
  31. {rloop-0.2.1 → rloop-0.3.1}/tests/tcp/__init__.py +0 -0
  32. {rloop-0.2.1 → rloop-0.3.1}/tests/tcp/test_tcp_conn.py +0 -0
  33. {rloop-0.2.1 → rloop-0.3.1}/tests/tcp/test_tcp_server.py +0 -0
  34. {rloop-0.2.1 → rloop-0.3.1}/tests/test_handles.py +0 -0
  35. {rloop-0.2.1 → rloop-0.3.1}/tests/test_sockets.py +0 -0
  36. {rloop-0.2.1 → rloop-0.3.1}/tests/udp/test_udp.py +0 -0
rloop-0.3.1/Cargo.lock ADDED
@@ -0,0 +1,220 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "anyhow"
7
+ version = "1.0.102"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
10
+
11
+ [[package]]
12
+ name = "equivalent"
13
+ version = "1.0.2"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
16
+
17
+ [[package]]
18
+ name = "heck"
19
+ version = "0.5.0"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
22
+
23
+ [[package]]
24
+ name = "libc"
25
+ version = "0.2.186"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
28
+
29
+ [[package]]
30
+ name = "log"
31
+ version = "0.4.32"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
34
+
35
+ [[package]]
36
+ name = "mio"
37
+ version = "1.2.1"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
40
+ dependencies = [
41
+ "libc",
42
+ "log",
43
+ "wasi",
44
+ "windows-sys",
45
+ ]
46
+
47
+ [[package]]
48
+ name = "once_cell"
49
+ version = "1.21.4"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
52
+
53
+ [[package]]
54
+ name = "papaya"
55
+ version = "0.2.4"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "997ee03cd38c01469a7046643714f0ad28880bcb9e6679ff0666e24817ca19b7"
58
+ dependencies = [
59
+ "equivalent",
60
+ "seize",
61
+ ]
62
+
63
+ [[package]]
64
+ name = "portable-atomic"
65
+ version = "1.13.1"
66
+ source = "registry+https://github.com/rust-lang/crates.io-index"
67
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
68
+
69
+ [[package]]
70
+ name = "proc-macro2"
71
+ version = "1.0.106"
72
+ source = "registry+https://github.com/rust-lang/crates.io-index"
73
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
74
+ dependencies = [
75
+ "unicode-ident",
76
+ ]
77
+
78
+ [[package]]
79
+ name = "pyo3"
80
+ version = "0.29.0"
81
+ source = "registry+https://github.com/rust-lang/crates.io-index"
82
+ checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
83
+ dependencies = [
84
+ "anyhow",
85
+ "libc",
86
+ "once_cell",
87
+ "portable-atomic",
88
+ "pyo3-build-config",
89
+ "pyo3-ffi",
90
+ "pyo3-macros",
91
+ ]
92
+
93
+ [[package]]
94
+ name = "pyo3-build-config"
95
+ version = "0.29.0"
96
+ source = "registry+https://github.com/rust-lang/crates.io-index"
97
+ checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
98
+ dependencies = [
99
+ "target-lexicon",
100
+ ]
101
+
102
+ [[package]]
103
+ name = "pyo3-ffi"
104
+ version = "0.29.0"
105
+ source = "registry+https://github.com/rust-lang/crates.io-index"
106
+ checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
107
+ dependencies = [
108
+ "libc",
109
+ "pyo3-build-config",
110
+ ]
111
+
112
+ [[package]]
113
+ name = "pyo3-macros"
114
+ version = "0.29.0"
115
+ source = "registry+https://github.com/rust-lang/crates.io-index"
116
+ checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
117
+ dependencies = [
118
+ "proc-macro2",
119
+ "pyo3-macros-backend",
120
+ "quote",
121
+ "syn",
122
+ ]
123
+
124
+ [[package]]
125
+ name = "pyo3-macros-backend"
126
+ version = "0.29.0"
127
+ source = "registry+https://github.com/rust-lang/crates.io-index"
128
+ checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
129
+ dependencies = [
130
+ "heck",
131
+ "proc-macro2",
132
+ "quote",
133
+ "syn",
134
+ ]
135
+
136
+ [[package]]
137
+ name = "quote"
138
+ version = "1.0.45"
139
+ source = "registry+https://github.com/rust-lang/crates.io-index"
140
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
141
+ dependencies = [
142
+ "proc-macro2",
143
+ ]
144
+
145
+ [[package]]
146
+ name = "rloop"
147
+ version = "0.3.1"
148
+ dependencies = [
149
+ "anyhow",
150
+ "libc",
151
+ "mio",
152
+ "papaya",
153
+ "pyo3",
154
+ "pyo3-build-config",
155
+ "socket2",
156
+ ]
157
+
158
+ [[package]]
159
+ name = "seize"
160
+ version = "0.5.1"
161
+ source = "registry+https://github.com/rust-lang/crates.io-index"
162
+ checksum = "5b55fb86dfd3a2f5f76ea78310a88f96c4ea21a3031f8d212443d56123fd0521"
163
+ dependencies = [
164
+ "libc",
165
+ "windows-sys",
166
+ ]
167
+
168
+ [[package]]
169
+ name = "socket2"
170
+ version = "0.6.4"
171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
172
+ checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"
173
+ dependencies = [
174
+ "libc",
175
+ "windows-sys",
176
+ ]
177
+
178
+ [[package]]
179
+ name = "syn"
180
+ version = "2.0.118"
181
+ source = "registry+https://github.com/rust-lang/crates.io-index"
182
+ checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
183
+ dependencies = [
184
+ "proc-macro2",
185
+ "quote",
186
+ "unicode-ident",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "target-lexicon"
191
+ version = "0.13.5"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
194
+
195
+ [[package]]
196
+ name = "unicode-ident"
197
+ version = "1.0.24"
198
+ source = "registry+https://github.com/rust-lang/crates.io-index"
199
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
200
+
201
+ [[package]]
202
+ name = "wasi"
203
+ version = "0.11.1+wasi-snapshot-preview1"
204
+ source = "registry+https://github.com/rust-lang/crates.io-index"
205
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
206
+
207
+ [[package]]
208
+ name = "windows-link"
209
+ version = "0.2.1"
210
+ source = "registry+https://github.com/rust-lang/crates.io-index"
211
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
212
+
213
+ [[package]]
214
+ name = "windows-sys"
215
+ version = "0.61.2"
216
+ source = "registry+https://github.com/rust-lang/crates.io-index"
217
+ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
218
+ dependencies = [
219
+ "windows-link",
220
+ ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rloop"
3
- version = "0.2.1"
3
+ version = "0.3.1"
4
4
  description = "An asyncio event loop implemented in Rust"
5
5
  authors = ["Giovanni Barillari <g@baro.dev>"]
6
6
  license = "BSD-3-Clause"
@@ -31,22 +31,18 @@ crate-type = ["cdylib", "rlib"]
31
31
 
32
32
  [dependencies]
33
33
  anyhow = "=1.0"
34
- mio = { version = "=1.0", features = ["net", "os-ext", "os-poll"] }
34
+ mio = { version = "=1.2", features = ["net", "os-ext", "os-poll"] }
35
35
  papaya = "=0.2"
36
- pyo3 = { version = "=0.26", features = ["anyhow", "extension-module", "generate-import-lib"] }
36
+ pyo3 = { version = "=0.29", features = ["anyhow", "extension-module", "generate-import-lib"] }
37
37
  socket2 = { version = "=0.6", features = ["all"] }
38
38
 
39
39
  [target.'cfg(unix)'.dependencies]
40
40
  libc = "0.2.159"
41
41
 
42
42
  [build-dependencies]
43
- pyo3-build-config = "=0.26"
43
+ pyo3-build-config = "=0.29"
44
44
 
45
45
  [profile.release]
46
- codegen-units = 1
47
- debug = false
48
- incremental = false
49
46
  lto = "fat"
50
- opt-level = 3
51
47
  panic = "abort"
52
48
  strip = true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rloop
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -8,11 +8,12 @@ Classifier: Operating System :: MacOS
8
8
  Classifier: Operating System :: POSIX :: Linux
9
9
  Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
14
  Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
16
17
  Classifier: Programming Language :: Python :: Implementation :: CPython
17
18
  Classifier: Programming Language :: Python :: Implementation :: PyPy
18
19
  Classifier: Programming Language :: Python
@@ -23,7 +24,7 @@ Keywords: asyncio
23
24
  Home-Page: https://github.com/gi0baro/rloop
24
25
  Author-email: Giovanni Barillari <g@baro.dev>
25
26
  License: BSD-3-Clause
26
- Requires-Python: >=3.9
27
+ Requires-Python: >=3.10
27
28
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
28
29
  Project-URL: Funding, https://github.com/sponsors/gi0baro
29
30
  Project-URL: Homepage, https://github.com/gi0baro/rloop
@@ -11,11 +11,12 @@ classifiers = [
11
11
  'Operating System :: POSIX :: Linux',
12
12
  'Programming Language :: Python :: Free Threading :: 2 - Beta',
13
13
  'Programming Language :: Python :: 3',
14
- 'Programming Language :: Python :: 3.9',
15
14
  'Programming Language :: Python :: 3.10',
16
15
  'Programming Language :: Python :: 3.11',
17
16
  'Programming Language :: Python :: 3.12',
18
17
  'Programming Language :: Python :: 3.13',
18
+ 'Programming Language :: Python :: 3.14',
19
+ 'Programming Language :: Python :: 3.15',
19
20
  'Programming Language :: Python :: Implementation :: CPython',
20
21
  'Programming Language :: Python :: Implementation :: PyPy',
21
22
  'Programming Language :: Python',
@@ -30,7 +31,7 @@ dynamic = [
30
31
  'version',
31
32
  ]
32
33
 
33
- requires-python = '>=3.9'
34
+ requires-python = '>=3.10'
34
35
  dependencies = []
35
36
 
36
37
  [dependency-groups]
@@ -45,6 +45,7 @@ pub struct EventLoopRunState {
45
45
  buf: Box<[u8]>,
46
46
  events: event::Events,
47
47
  pub read_buf: Box<[u8]>,
48
+ ready: VecDeque<BoxedHandle>,
48
49
  tick_last: u128,
49
50
  }
50
51
 
@@ -141,10 +142,11 @@ impl EventLoop {
141
142
  res
142
143
  };
143
144
 
144
- let mut cb_handles = {
145
+ let mut cb_handles = mem::take(&mut state.ready);
146
+ {
145
147
  let mut guard_cb = self.handles_ready.lock().unwrap();
146
- mem::replace(&mut *guard_cb, VecDeque::with_capacity(128))
147
- };
148
+ mem::swap(&mut *guard_cb, &mut cb_handles);
149
+ }
148
150
  self.counter_ready
149
151
  .fetch_sub(cb_handles.len(), atomic::Ordering::Release);
150
152
 
@@ -187,6 +189,8 @@ impl EventLoop {
187
189
  }
188
190
  }
189
191
 
192
+ state.ready = cb_handles;
193
+
190
194
  poll_result
191
195
  }
192
196
 
@@ -1242,6 +1246,7 @@ impl EventLoop {
1242
1246
  buf: vec![0; 4096].into_boxed_slice(),
1243
1247
  events: event::Events::with_capacity(128),
1244
1248
  read_buf: vec![0; 262_144].into_boxed_slice(),
1249
+ ready: VecDeque::with_capacity(128),
1245
1250
  tick_last: 0,
1246
1251
  };
1247
1252
 
@@ -24,6 +24,11 @@ use crate::{
24
24
  utils::syscall,
25
25
  };
26
26
 
27
+ // PyO3 removed private CPython's APIs
28
+ unsafe extern "C" {
29
+ fn _PyBytes_Resize(bytes: *mut *mut pyo3::ffi::PyObject, newsize: pyo3::ffi::Py_ssize_t) -> std::os::raw::c_int;
30
+ }
31
+
27
32
  pub(crate) struct TCPServer {
28
33
  pub fd: i32,
29
34
  sfamily: i32,
@@ -164,6 +169,9 @@ impl TCPTransport {
164
169
  lfd: Option<usize>,
165
170
  ) -> Self {
166
171
  let fd = stream.as_raw_fd() as usize;
172
+ if socket_family == libc::AF_INET || socket_family == libc::AF_INET6 {
173
+ _ = stream.set_nodelay(true);
174
+ }
167
175
  let state = TCPTransportState {
168
176
  stream,
169
177
  write_buf: VecDeque::new(),
@@ -554,30 +562,56 @@ pub(crate) struct TCPReadHandle {
554
562
 
555
563
  impl TCPReadHandle {
556
564
  #[inline]
557
- fn recv_direct(&self, py: Python, transport: &TCPTransport, buf: &mut [u8]) -> (Option<Py<PyAny>>, bool) {
565
+ fn recv_direct(&self, py: Python, transport: &TCPTransport) -> (Option<Py<PyAny>>, bool, bool) {
566
+ const BUF_MAXSIZE: usize = 262_144;
567
+ //: alloc an uninitialized `PyBytes` and read into it: single copy (kernel -> bytes), matching asyncio/CPython's `sock.recv`
568
+ let mut obj =
569
+ unsafe { pyo3::ffi::PyBytes_FromStringAndSize(std::ptr::null(), BUF_MAXSIZE as pyo3::ffi::Py_ssize_t) };
570
+ if obj.is_null() {
571
+ unsafe { pyo3::ffi::PyErr_Clear() };
572
+ return (None, false, false);
573
+ }
574
+ let buf = unsafe { std::slice::from_raw_parts_mut(pyo3::ffi::PyBytes_AsString(obj).cast::<u8>(), BUF_MAXSIZE) };
575
+
558
576
  let (read, closed) = self.read_into(&mut transport.state.borrow_mut().stream, buf);
559
577
  if read > 0 {
560
- let rbuf = &buf[..read];
561
- let pydata = unsafe { PyBytes::from_ptr(py, rbuf.as_ptr(), read) };
562
- return (Some(pydata.into_any().unbind()), closed);
578
+ if read < BUF_MAXSIZE && unsafe { _PyBytes_Resize(&mut obj, read as pyo3::ffi::Py_ssize_t) } != 0 {
579
+ unsafe { pyo3::ffi::PyErr_Clear() };
580
+ return (None, closed, false);
581
+ }
582
+ let pydata = unsafe { Bound::from_owned_ptr(py, obj).unbind() };
583
+ // `read == BUF_MAXSIZE` means the buffer filled, so more data may be waiting.
584
+ return (Some(pydata), closed, read == BUF_MAXSIZE);
563
585
  }
564
- (None, closed)
586
+ unsafe { pyo3::ffi::Py_DECREF(obj) };
587
+ (None, closed, false)
565
588
  }
566
589
 
567
590
  #[inline]
568
- fn recv_buffered(&self, py: Python, transport: &TCPTransport) -> (Option<Py<PyAny>>, bool) {
569
- // NOTE: `PuBuffer.as_mut_slice` exists, but it returns a slice of `Cell<u8>`,
570
- // which is smth we can't really use to read from `TcpStream`.
571
- // So even if this sucks, we copy data back and forth, at least until
572
- // we figure out a way to actually use `PyBuffer` directly.
591
+ fn recv_buffered(&self, py: Python, transport: &TCPTransport) -> (Option<Py<PyAny>>, bool, bool) {
573
592
  let pybuf: PyBuffer<u8> = PyBuffer::get(&transport.protom_buf_get.bind(py).call1((-1,)).unwrap()).unwrap();
574
- let mut vbuf = pybuf.to_vec(py).unwrap();
575
- let (read, closed) = self.read_into(&mut transport.state.borrow_mut().stream, vbuf.as_mut_slice());
593
+ let max_len = pybuf.len_bytes();
594
+
595
+ let (read, closed) = if pybuf.is_c_contiguous() && !pybuf.readonly() {
596
+ // Read straight into the protocol's buffer, no intermediate allocation or
597
+ // copy. The GIL is held for the whole call, so nothing else can touch the
598
+ // buffer concurrently, and we only access it through this slice.
599
+ let buf = unsafe { std::slice::from_raw_parts_mut(pybuf.buf_ptr().cast::<u8>(), max_len) };
600
+ self.read_into(&mut transport.state.borrow_mut().stream, buf)
601
+ } else {
602
+ // Fallback for non-contiguous/read-only buffers: copy through a temp Vec.
603
+ let mut vbuf = pybuf.to_vec(py).unwrap();
604
+ let (read, closed) = self.read_into(&mut transport.state.borrow_mut().stream, vbuf.as_mut_slice());
605
+ if read > 0 {
606
+ _ = pybuf.copy_from_slice(py, &vbuf[..read]);
607
+ }
608
+ (read, closed)
609
+ };
610
+
576
611
  if read > 0 {
577
- _ = pybuf.copy_from_slice(py, &vbuf[..]);
578
- return (Some(read.into_py_any(py).unwrap()), closed);
612
+ return (Some(read.into_py_any(py).unwrap()), closed, read == max_len);
579
613
  }
580
- (None, closed)
614
+ (None, closed, false)
581
615
  }
582
616
 
583
617
  #[inline(always)]
@@ -615,7 +649,7 @@ impl TCPReadHandle {
615
649
  }
616
650
 
617
651
  impl Handle for TCPReadHandle {
618
- fn run(&self, py: Python, event_loop: &EventLoop, state: &mut EventLoopRunState) {
652
+ fn run(&self, py: Python, event_loop: &EventLoop, _state: &mut EventLoopRunState) {
619
653
  let pytransport = event_loop.get_tcp_transport(self.fd, py);
620
654
  let transport = pytransport.borrow(py);
621
655
 
@@ -623,14 +657,14 @@ impl Handle for TCPReadHandle {
623
657
  // otherwise we won't get another readable event from the poller
624
658
  let mut close = false;
625
659
  loop {
626
- let (data, eof) = match transport.proto_buffered {
660
+ let (data, eof, full) = match transport.proto_buffered {
627
661
  true => self.recv_buffered(py, &transport),
628
- false => self.recv_direct(py, &transport, &mut state.read_buf),
662
+ false => self.recv_direct(py, &transport),
629
663
  };
630
664
 
631
665
  if let Some(data) = data {
632
666
  _ = transport.protom_recv_data.call1(py, (data,));
633
- if !eof {
667
+ if !eof && full {
634
668
  continue;
635
669
  }
636
670
  }
rloop-0.2.1/Cargo.lock DELETED
@@ -1,350 +0,0 @@
1
- # This file is automatically @generated by Cargo.
2
- # It is not intended for manual editing.
3
- version = 4
4
-
5
- [[package]]
6
- name = "anyhow"
7
- version = "1.0.99"
8
- source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
10
-
11
- [[package]]
12
- name = "autocfg"
13
- version = "1.5.0"
14
- source = "registry+https://github.com/rust-lang/crates.io-index"
15
- checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
16
-
17
- [[package]]
18
- name = "cc"
19
- version = "1.2.37"
20
- source = "registry+https://github.com/rust-lang/crates.io-index"
21
- checksum = "65193589c6404eb80b450d618eaf9a2cafaaafd57ecce47370519ef674a7bd44"
22
- dependencies = [
23
- "find-msvc-tools",
24
- "shlex",
25
- ]
26
-
27
- [[package]]
28
- name = "equivalent"
29
- version = "1.0.2"
30
- source = "registry+https://github.com/rust-lang/crates.io-index"
31
- checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
32
-
33
- [[package]]
34
- name = "find-msvc-tools"
35
- version = "0.1.1"
36
- source = "registry+https://github.com/rust-lang/crates.io-index"
37
- checksum = "7fd99930f64d146689264c637b5af2f0233a933bef0d8570e2526bf9e083192d"
38
-
39
- [[package]]
40
- name = "heck"
41
- version = "0.5.0"
42
- source = "registry+https://github.com/rust-lang/crates.io-index"
43
- checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
44
-
45
- [[package]]
46
- name = "indoc"
47
- version = "2.0.6"
48
- source = "registry+https://github.com/rust-lang/crates.io-index"
49
- checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
50
-
51
- [[package]]
52
- name = "libc"
53
- version = "0.2.175"
54
- source = "registry+https://github.com/rust-lang/crates.io-index"
55
- checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
56
-
57
- [[package]]
58
- name = "log"
59
- version = "0.4.28"
60
- source = "registry+https://github.com/rust-lang/crates.io-index"
61
- checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
62
-
63
- [[package]]
64
- name = "memoffset"
65
- version = "0.9.1"
66
- source = "registry+https://github.com/rust-lang/crates.io-index"
67
- checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
68
- dependencies = [
69
- "autocfg",
70
- ]
71
-
72
- [[package]]
73
- name = "mio"
74
- version = "1.0.4"
75
- source = "registry+https://github.com/rust-lang/crates.io-index"
76
- checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
77
- dependencies = [
78
- "libc",
79
- "log",
80
- "wasi",
81
- "windows-sys 0.59.0",
82
- ]
83
-
84
- [[package]]
85
- name = "once_cell"
86
- version = "1.21.3"
87
- source = "registry+https://github.com/rust-lang/crates.io-index"
88
- checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
89
-
90
- [[package]]
91
- name = "papaya"
92
- version = "0.2.3"
93
- source = "registry+https://github.com/rust-lang/crates.io-index"
94
- checksum = "f92dd0b07c53a0a0c764db2ace8c541dc47320dad97c2200c2a637ab9dd2328f"
95
- dependencies = [
96
- "equivalent",
97
- "seize",
98
- ]
99
-
100
- [[package]]
101
- name = "portable-atomic"
102
- version = "1.11.1"
103
- source = "registry+https://github.com/rust-lang/crates.io-index"
104
- checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
105
-
106
- [[package]]
107
- name = "proc-macro2"
108
- version = "1.0.101"
109
- source = "registry+https://github.com/rust-lang/crates.io-index"
110
- checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
111
- dependencies = [
112
- "unicode-ident",
113
- ]
114
-
115
- [[package]]
116
- name = "pyo3"
117
- version = "0.26.0"
118
- source = "registry+https://github.com/rust-lang/crates.io-index"
119
- checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
120
- dependencies = [
121
- "anyhow",
122
- "indoc",
123
- "libc",
124
- "memoffset",
125
- "once_cell",
126
- "portable-atomic",
127
- "pyo3-build-config",
128
- "pyo3-ffi",
129
- "pyo3-macros",
130
- "unindent",
131
- ]
132
-
133
- [[package]]
134
- name = "pyo3-build-config"
135
- version = "0.26.0"
136
- source = "registry+https://github.com/rust-lang/crates.io-index"
137
- checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
138
- dependencies = [
139
- "python3-dll-a",
140
- "target-lexicon",
141
- ]
142
-
143
- [[package]]
144
- name = "pyo3-ffi"
145
- version = "0.26.0"
146
- source = "registry+https://github.com/rust-lang/crates.io-index"
147
- checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
148
- dependencies = [
149
- "libc",
150
- "pyo3-build-config",
151
- ]
152
-
153
- [[package]]
154
- name = "pyo3-macros"
155
- version = "0.26.0"
156
- source = "registry+https://github.com/rust-lang/crates.io-index"
157
- checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
158
- dependencies = [
159
- "proc-macro2",
160
- "pyo3-macros-backend",
161
- "quote",
162
- "syn",
163
- ]
164
-
165
- [[package]]
166
- name = "pyo3-macros-backend"
167
- version = "0.26.0"
168
- source = "registry+https://github.com/rust-lang/crates.io-index"
169
- checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
170
- dependencies = [
171
- "heck",
172
- "proc-macro2",
173
- "pyo3-build-config",
174
- "quote",
175
- "syn",
176
- ]
177
-
178
- [[package]]
179
- name = "python3-dll-a"
180
- version = "0.2.14"
181
- source = "registry+https://github.com/rust-lang/crates.io-index"
182
- checksum = "d381ef313ae70b4da5f95f8a4de773c6aa5cd28f73adec4b4a31df70b66780d8"
183
- dependencies = [
184
- "cc",
185
- ]
186
-
187
- [[package]]
188
- name = "quote"
189
- version = "1.0.40"
190
- source = "registry+https://github.com/rust-lang/crates.io-index"
191
- checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
192
- dependencies = [
193
- "proc-macro2",
194
- ]
195
-
196
- [[package]]
197
- name = "rloop"
198
- version = "0.2.1"
199
- dependencies = [
200
- "anyhow",
201
- "libc",
202
- "mio",
203
- "papaya",
204
- "pyo3",
205
- "pyo3-build-config",
206
- "socket2",
207
- ]
208
-
209
- [[package]]
210
- name = "seize"
211
- version = "0.5.0"
212
- source = "registry+https://github.com/rust-lang/crates.io-index"
213
- checksum = "e4b8d813387d566f627f3ea1b914c068aac94c40ae27ec43f5f33bde65abefe7"
214
- dependencies = [
215
- "libc",
216
- "windows-sys 0.52.0",
217
- ]
218
-
219
- [[package]]
220
- name = "shlex"
221
- version = "1.3.0"
222
- source = "registry+https://github.com/rust-lang/crates.io-index"
223
- checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
224
-
225
- [[package]]
226
- name = "socket2"
227
- version = "0.6.0"
228
- source = "registry+https://github.com/rust-lang/crates.io-index"
229
- checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807"
230
- dependencies = [
231
- "libc",
232
- "windows-sys 0.59.0",
233
- ]
234
-
235
- [[package]]
236
- name = "syn"
237
- version = "2.0.106"
238
- source = "registry+https://github.com/rust-lang/crates.io-index"
239
- checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
240
- dependencies = [
241
- "proc-macro2",
242
- "quote",
243
- "unicode-ident",
244
- ]
245
-
246
- [[package]]
247
- name = "target-lexicon"
248
- version = "0.13.3"
249
- source = "registry+https://github.com/rust-lang/crates.io-index"
250
- checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
251
-
252
- [[package]]
253
- name = "unicode-ident"
254
- version = "1.0.19"
255
- source = "registry+https://github.com/rust-lang/crates.io-index"
256
- checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
257
-
258
- [[package]]
259
- name = "unindent"
260
- version = "0.2.4"
261
- source = "registry+https://github.com/rust-lang/crates.io-index"
262
- checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
263
-
264
- [[package]]
265
- name = "wasi"
266
- version = "0.11.1+wasi-snapshot-preview1"
267
- source = "registry+https://github.com/rust-lang/crates.io-index"
268
- checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
269
-
270
- [[package]]
271
- name = "windows-sys"
272
- version = "0.52.0"
273
- source = "registry+https://github.com/rust-lang/crates.io-index"
274
- checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
275
- dependencies = [
276
- "windows-targets",
277
- ]
278
-
279
- [[package]]
280
- name = "windows-sys"
281
- version = "0.59.0"
282
- source = "registry+https://github.com/rust-lang/crates.io-index"
283
- checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
284
- dependencies = [
285
- "windows-targets",
286
- ]
287
-
288
- [[package]]
289
- name = "windows-targets"
290
- version = "0.52.6"
291
- source = "registry+https://github.com/rust-lang/crates.io-index"
292
- checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
293
- dependencies = [
294
- "windows_aarch64_gnullvm",
295
- "windows_aarch64_msvc",
296
- "windows_i686_gnu",
297
- "windows_i686_gnullvm",
298
- "windows_i686_msvc",
299
- "windows_x86_64_gnu",
300
- "windows_x86_64_gnullvm",
301
- "windows_x86_64_msvc",
302
- ]
303
-
304
- [[package]]
305
- name = "windows_aarch64_gnullvm"
306
- version = "0.52.6"
307
- source = "registry+https://github.com/rust-lang/crates.io-index"
308
- checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
309
-
310
- [[package]]
311
- name = "windows_aarch64_msvc"
312
- version = "0.52.6"
313
- source = "registry+https://github.com/rust-lang/crates.io-index"
314
- checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
315
-
316
- [[package]]
317
- name = "windows_i686_gnu"
318
- version = "0.52.6"
319
- source = "registry+https://github.com/rust-lang/crates.io-index"
320
- checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
321
-
322
- [[package]]
323
- name = "windows_i686_gnullvm"
324
- version = "0.52.6"
325
- source = "registry+https://github.com/rust-lang/crates.io-index"
326
- checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
327
-
328
- [[package]]
329
- name = "windows_i686_msvc"
330
- version = "0.52.6"
331
- source = "registry+https://github.com/rust-lang/crates.io-index"
332
- checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
333
-
334
- [[package]]
335
- name = "windows_x86_64_gnu"
336
- version = "0.52.6"
337
- source = "registry+https://github.com/rust-lang/crates.io-index"
338
- checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
339
-
340
- [[package]]
341
- name = "windows_x86_64_gnullvm"
342
- version = "0.52.6"
343
- source = "registry+https://github.com/rust-lang/crates.io-index"
344
- checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
345
-
346
- [[package]]
347
- name = "windows_x86_64_msvc"
348
- version = "0.52.6"
349
- source = "registry+https://github.com/rust-lang/crates.io-index"
350
- checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes