ipn{,/ipnlocal}: in direct file receive mode, don't rename partial file

Let caller (macOS) do it so Finder progress bar can be dismissed
without races.

Updates tailscale/corp#1575

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-04-16 12:33:04 -07:00
committed by David Crawshaw
parent 48e30bb8de
commit 3d0599fca0
2 changed files with 24 additions and 22 deletions

View File

@ -95,12 +95,15 @@ type PartialFile struct {
DeclaredSize int64 // or -1 if unknown
Received int64 // bytes copied thus far
// FinalPath is non-empty when the final has been completely
// written and renamed into place. This is then the complete
// path to the file post-rename. This is only set in
// "direct" file mode where the peerapi isn't being used; see
// LocalBackend.SetDirectFileRoot.
FinalPath string `json:",omitempty"`
// PartialPath is set non-empty in "direct" file mode to the
// in-progress '*.partial' file's path when the peerapi isn't
// being used; see LocalBackend.SetDirectFileRoot.
PartialPath string `json:",omitempty"`
// Done is set in "direct" mode when the partial file has been
// closed and is ready for the caller to rename away the
// ".partial" suffix.
Done bool `json:",omitempty"`
}
// StateKey is an opaque identifier for a set of LocalBackend state