fix(rpc): make IO stream lifecycle race-safe

Co-authored-by: naiba/CloudCode <hi+cloudcode@nai.ba>
This commit is contained in:
naibaandnaiba/CloudCode committed 2026-07-20 04:26:19 +00:00
1 parent 8b47ff141f
commit c756ef9385
23 files changed
+2114 -690

No files matched your search

+3
View File
@@ -120,6 +120,9 @@ func (iw *IOStreamWrapper) Write(p []byte) (n int, err error) {
func (iw *IOStreamWrapper) Close() error {
if iw.closed.CompareAndSwap(false, true) {
close(iw.closeCh)
if closer, ok := iw.IOStream.(interface{ Close() error }); ok {
return closer.Close()
}
}
return nil
}