fix: send file-done before closing file DC to avoid control channel race
Closing the file DataChannel can trigger SCTP/ICE cleanup before the file-done control message is flushed, causing a 15 s timeout on the receiver. Send file-done first on both the Go and TS sender paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -758,11 +758,12 @@ func (s *Session) SendFile(path string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// §9: send file-done before closing the file DC so the control channel
|
||||
// is still reachable when the message is delivered.
|
||||
s.controlSend(map[string]string{"type": "file-done", "xid": xid, "sha256": sha256hex})
|
||||
if err := dc.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
// §9: send file-done with the pre-computed hash so the receiver can verify.
|
||||
s.controlSend(map[string]string{"type": "file-done", "xid": xid, "sha256": sha256hex})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user