aboutsummaryrefslogtreecommitdiff
path: root/hotline/server.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-11-07 20:05:25 -0800
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-11-07 20:05:25 -0800
commit94742e2f44ca08a64c1851aa1a00c3e9f266d0e9 (patch)
tree42b8e4e380b9ff0616261e212287fe295ca8c0a6 /hotline/server.go
parent501973cdaaccc9f10c1427cab7edaddf7f89fcdb (diff)
Add workaround for Windows file transfer errors
Diffstat (limited to 'hotline/server.go')
-rw-r--r--hotline/server.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/hotline/server.go b/hotline/server.go
index 8d6803b..164b93e 100644
--- a/hotline/server.go
+++ b/hotline/server.go
@@ -749,6 +749,10 @@ func (s *Server) handleFileTransfer(ctx context.Context, rwc io.ReadWriter) erro
delete(s.fileTransfers, t.ReferenceNumber)
s.mux.Unlock()
+ // Wait a few seconds before closing the connection: this is a workaround for problems
+ // observed with Windows clients where the client must initiate close of the TCP connection before
+ // the server does. This is gross and seems unnecessary. TODO: Revisit?
+ time.Sleep(3 * time.Second)
}()
s.mux.Lock()
@@ -783,7 +787,9 @@ func (s *Server) handleFileTransfer(ctx context.Context, rwc io.ReadWriter) erro
case FileDownload:
s.Stats.DownloadCounter += 1
s.Stats.DownloadsInProgress += 1
- defer func() { s.Stats.DownloadsInProgress -= 1 }()
+ defer func() {
+ s.Stats.DownloadsInProgress -= 1
+ }()
var dataOffset int64
if fileTransfer.fileResumeData != nil {