Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Verify rsync protocol version match prior to proceeding - Rebased on current master. #71

Merged
merged 7 commits into from
Jul 2, 2020
Prev Previous commit
Next Next commit
Add context to sync.Version.
  • Loading branch information
stephenwithav committed Jul 1, 2020
commit 5538af614d7bf1ca7277c94f074bfd8b1a7ec6cd
6 changes: 3 additions & 3 deletions internal/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,15 @@ const (
// Returns remote protocol version as a string.
// Or, an error if one exists.
func (s Sync) Version() (string, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

conn, err := s.Client.DialWsep(ctx, s.Env)
if err != nil {
return "", err
}
defer conn.Close(websocket.CloseNormalClosure, "")

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

execer := wsep.RemoteExecer(conn)
process, err := execer.Start(ctx, wsep.Command{
Command: "rsync",
Expand Down