BBS:      TELESC.NET.BR
Assunto:  src/sbbs3/mqtt.c
De:       Deuc¨
Data:     Thu, 7 May 2026 02:03:23 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/fb788069b14684762744d5de
Modified Files:
	src/sbbs3/mqtt.c
Log Message:
mqtt.c: fix server state not published correctly on connect

mqtt_server_state() only updated mqtt->server_state inside the publish
block, so when mqtt->connected was false (race between synchronous
TCP connect and async CONNACK callback), the state transition was
lost. Move the state update before the publish so it's always tracked.

mqtt_server_startup() hardcoded SERVER_INIT, overwriting the real state
if the MQTT connect callback fired after the server had already
transitioned to SERVER_READY. Use mqtt->server_state instead.

On reconnect (server_version is NULL), re-publish the current state
so the broker has the correct retained server-level status.

Co-Authored-By: Claude Opus 4.6 (1M context) 
n
---
  mSynchronetn  hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net

-----------------------------------------------------------
[Voltar]