Commit 8cc269c
committed
ltc: Send() socket deadline + desync-safe teardown (parity with dash #781)
LTC (the live LTC-DOGE prod reference) already has the thread_pool decouple
and m_rpc_mutex, but NodeRPC::Send() had no deadline: a wedged-but-connected
litecoind/dogecoind (socket open, no bytes) hangs the blocking http::read
forever -> permanent refresh-wedge + SIGINT-hang on join.
Port DASH #781's mechanism verbatim into impl/ltc/coin/rpc.cpp:
- apply_socket_timeouts(): force the socket back to BLOCKING mode
(async_connect leaves asio's non_blocking flag set, under which SO_*TIMEO is
a no-op) then set kernel SO_RCVTIMEO/SO_SNDTIMEO = RPC_IO_TIMEOUT_SECONDS
(12). Called after every successful (re)connect. beast's synchronous
read_some/write_some do not honour tcp_stream::expires_after (async-only),
so the kernel timeout is the robust bound. #ifndef _WIN32 guarded (Linux
release target; Windows keeps pre-parity no-deadline behaviour).
- close_stream(): the desync-safe teardown on the FINAL-attempt Send() exits
(both write-fail and read-fail). This is the critical half: the deadline
alone reintroduces the off-by-one response desync. LTC's NodeRPC shares
DASH's shape -- the constant id "curltest" driving jsonrpccxx, which never
validates response ids -- so a timed-out-but-open stream reused by the next
Send() would read this request's late response (a GBT parsing a
getbestblockhash string -> zeroed work -> a stuck honest set-gap outage).
Tearing the socket down makes the next Send() write-fail into a clean
sync_reconnect().
LTC already had m_rpc_mutex (class B), so no mutex work was needed.
Transport/liveness only -- zero wire-byte change, consensus-neutral (no
share/target/payout/vardiff logic touched).1 parent 9ac8b3d commit 8cc269c
2 files changed
Lines changed: 90 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
11 | 17 | | |
| |||
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| |||
128 | 138 | | |
129 | 139 | | |
130 | 140 | | |
| 141 | + | |
131 | 142 | | |
132 | 143 | | |
133 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
134 | 186 | | |
135 | 187 | | |
136 | 188 | | |
| |||
151 | 203 | | |
152 | 204 | | |
153 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
154 | 210 | | |
155 | 211 | | |
156 | 212 | | |
| |||
169 | 225 | | |
170 | 226 | | |
171 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
172 | 239 | | |
173 | 240 | | |
174 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
61 | 84 | | |
62 | 85 | | |
63 | 86 | | |
| |||
0 commit comments