Commit 4ec7394
std/sys/net/xous: read NetError code from byte 4 in recv/accept paths
`respond_with_error` in xous-core's `services/net/src/std_glue.rs`
writes the `NetError` code at byte 4 of the 8-byte response
buffer. The send path in `tcpstream.rs::write` correctly reads
`send_request.raw[4]`. The recv-side decoders, however, read
`result[1]` / `raw[1]`, which under the historical
`[1, 1, 1, 1, code, 0, 0, 0]` layout is always `1` — so
`ErrorKind::TimedOut` and `ErrorKind::WouldBlock` were
unreachable from the recv side.
Three files affected, identical pattern:
- `tcpstream.rs::read_or_peek` (recv decode)
- `udp.rs` (UDP recv decode)
- `tcplistener.rs` (accept decode)
Each `result[1]` / `raw[1]` becomes `result[4]` / `raw[4]`,
matching the send path. Behavior is unchanged for any kernel
that respects the existing 8-byte error layout.
A complementary kernel-side change in betrusted-io/xous-core
(betrusted-io/xous-core#877) mirrors
the code at byte 1 too, so existing toolchain versions also
see the right value immediately. The two changes are non-
conflicting.
Co-authored-by: Nia <nia-e@haecceity.cc>1 parent 99eed20 commit 4ec7394
3 files changed
Lines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
134 | 135 | | |
135 | | - | |
| 136 | + | |
136 | 137 | | |
137 | | - | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
220 | | - | |
| 223 | + | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | | - | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
0 commit comments