Commit ec84d0e
committed
Send MQTT packets atomically in a single socket write
Previously the fixed header and payload were sent in
separate async socket writes. Since each write awaits,
other tasks could interleave writes on the same socket,
potentially corrupting packet framing.
This change builds a single contiguous buffer and sends
it in one async write call to ensure packet atomicity.
Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>1 parent 93bc8e5 commit ec84d0e
1 file changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
359 | | - | |
| 358 | + | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
373 | | - | |
374 | 372 | | |
375 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
376 | 377 | | |
377 | 378 | | |
378 | 379 | | |
| |||
0 commit comments