Commit 697a54e
Pr 1123 merge (#1144)
* Move globals into respective class
File-scope globals were shared across every instance of the class. If more than one SimpleStream instance were ever loaded, they would silently share the same stream list and TCP I/O service, likely causing data corruption and race conditions.
* Use const auto & in BOOST_FOREACH stream loops
Copying a struct with a raw pointer wont manage the socket lifetime, and two copies of the same pointer could interact badly. It also needlessly copies two std::string members and a UDP endpoint on every audio packet, which is a hot path. The const auto & form avoids all copies entirely. The start() and stop() loops already used auto& correctly, so this change just introduces consistency
* Wrap all TCP calls with try/catch and add error logging
Dropped TCP connections throws boots::system::system_error, which would terminate the TR process. It should now log errors and continue. For UDP, there was no logging for errors to know when packets are dropped
* Use resolver for hostname support and add error logging
from_string() only accepts literal IP addresses, entering a hostname would throw an error and crash TR with no explanation.
* Implement URL-based configuration
Adds support for a url field in the simplestream config. Can now be defined as udp://hostname:port or tcp://hostname:port instead of
separate address, port, and useTCP fields.
Added deprecation warning log and updated documentation to reflect changes and deprecation intent
* Merge master into PR #1123 (SimpleStream improvements)
Resolves conflicts in plugins/simplestream/simplestream.cc between the PR's
class-encapsulation/resolver work and master's ASIO modernization (#1129).
PR intent preserved:
- streams/io_context/max_tcp_index moved from file-scope globals into
Simple_Stream class members
- BOOST_FOREACH loops use const auto& to avoid copying stream_t
- TCP send wrapped in try/catch; UDP send_to errors logged
- Hostname resolution support via resolver (now using the modern
resolve(host, service) overload instead of the deprecated
resolver::query / resolver::iterator API, since master moved to io_context)
- url-based config (udp://host:port / tcp://host:port) with deprecation
warning for address/port/useTCP
Master changes preserved:
- io_service -> io_context rename (#1129) applied to both my_io_context
and the moved my_tcp_io_context
- json_length scope fix (#1107) already absorbed via the PR base
Docs auto-merged: docs/CONFIGURE.md keeps both master's outputRawAudio
additions and the PR's url field documentation.
---------
Co-authored-by: jameson-dev <178156579+jameson-dev@users.noreply.github.com>1 parent c8ebef7 commit 697a54e
3 files changed
Lines changed: 89 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
711 | | - | |
712 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
716 | 717 | | |
717 | 718 | | |
718 | 719 | | |
719 | | - | |
| 720 | + | |
720 | 721 | | |
721 | 722 | | |
722 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
123 | | - | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
| 34 | + | |
37 | 35 | | |
38 | 36 | | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
52 | 88 | | |
53 | 89 | | |
54 | 90 | | |
55 | 91 | | |
56 | | - | |
57 | 92 | | |
58 | | - | |
| 93 | + | |
59 | 94 | | |
60 | 95 | | |
61 | 96 | | |
| |||
92 | 127 | | |
93 | 128 | | |
94 | 129 | | |
95 | | - | |
| 130 | + | |
96 | 131 | | |
97 | 132 | | |
98 | 133 | | |
| |||
128 | 163 | | |
129 | 164 | | |
130 | 165 | | |
131 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
132 | 171 | | |
133 | 172 | | |
134 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
135 | 177 | | |
136 | 178 | | |
137 | 179 | | |
| |||
164 | 206 | | |
165 | 207 | | |
166 | 208 | | |
167 | | - | |
| 209 | + | |
168 | 210 | | |
169 | 211 | | |
170 | 212 | | |
| |||
200 | 242 | | |
201 | 243 | | |
202 | 244 | | |
203 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
204 | 250 | | |
205 | 251 | | |
206 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
207 | 256 | | |
208 | 257 | | |
209 | 258 | | |
| |||
215 | 264 | | |
216 | 265 | | |
217 | 266 | | |
218 | | - | |
| 267 | + | |
219 | 268 | | |
220 | 269 | | |
221 | 270 | | |
| |||
248 | 297 | | |
249 | 298 | | |
250 | 299 | | |
251 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
252 | 305 | | |
253 | 306 | | |
254 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
255 | 311 | | |
256 | 312 | | |
257 | 313 | | |
| |||
266 | 322 | | |
267 | 323 | | |
268 | 324 | | |
269 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
270 | 336 | | |
271 | 337 | | |
272 | 338 | | |
| |||
0 commit comments