Commit 272e3a3
committed
handshake: read single message with bounded Read instead of io.ReadAll
io.ReadAll blocks until the stream is closed (EOF). For relay-based
connections FIN may not propagate to the receiver, causing every inbound
handshake to time out after handshakeRecvTimeout (10 s) instead of
processing immediately. Since the handshake protocol is exactly one JSON
message per connection, a single stream.Read(buf) is sufficient and
returns as soon as the bytes land.1 parent 0ba7677 commit 272e3a3
2 files changed
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
388 | 391 | | |
| 392 | + | |
| 393 | + | |
389 | 394 | | |
390 | 395 | | |
391 | 396 | | |
392 | 397 | | |
393 | 398 | | |
394 | 399 | | |
395 | | - | |
396 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
397 | 407 | | |
398 | 408 | | |
399 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
0 commit comments