BBS:      TELESC.NET.BR
Assunto:  src/sbbs3/ctrl/MainFormUnit.cpp
De:       Rob Swindell (on Windows 11)
Data:     Sat, 23 May 2026 21:46:34 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/1082de20dca523f276c780ba
Modified Files:
	src/sbbs3/ctrl/MainFormUnit.cpp
Log Message:
sbbsctrl: fflush per-server disk-log streams after each write

Follow-up to 9a207243c (resolved #1146): with the Stop->Enabled gate
removed, the shutdown-summary line now reaches the disk-log fwrite() in
each of the four xxx_log_msg() handlers -- but rob noticed that the
line still didn't *appear* in the file until sbbsctrl was quit. Cause:
_fsopen() returns a fully-buffered stream, and the handlers never flush;
written data sits in the CRT buffer until the close sentinel (msg==NULL)
calls fclose() at sbbsctrl shutdown, or until the next date rollover
recreates the file.

Add a plain fflush(LogStream) after each fwrite(). On Windows this is
essentially free -- fflush copies the CRT buffer to the OS page cache
(no FlushFileBuffers, no disk sync), and the OS handles physical
writeback on its own schedule -- so per-line flushing is fine and
avoids the "lines stranded indefinitely after the last write of a
quiet period" failure mode of any timer/threshold-based scheme.

Same provenance as the previous fix: the missing-fflush has been in
the Mail/FTP handlers since the initial v3.00c import in 2000
(7e3e47141), and was propagated to the new Telnet/Web handlers in
d0252720e (resolves #1108).

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

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