Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions lib/web/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"strings"
"sync"

"github.com/coreos/go-semver/semver"
"github.com/gorilla/websocket"
"github.com/gravitational/trace"
"github.com/julienschmidt/httprouter"
Expand Down Expand Up @@ -176,7 +175,7 @@ func (h *Handler) createDesktopConnection(
clientSrcAddr: clientSrcAddr,
clientDstAddr: clientDstAddr,
}
serviceConn, version, err := c.connectToWindowsService(clusterName, validServiceIDs)
serviceConn, _, err := c.connectToWindowsService(clusterName, validServiceIDs)
if err != nil {
return sendTDPError(trace.Wrap(err, "cannot connect to Windows Desktop Service"))
}
Expand All @@ -201,7 +200,7 @@ func (h *Handler) createDesktopConnection(

// proxyWebsocketConn hangs here until connection is closed
handleProxyWebsocketConnErr(
proxyWebsocketConn(ws, serviceConnTLS, version), log)
proxyWebsocketConn(ws, serviceConnTLS), log)

return nil
}
Expand Down Expand Up @@ -432,20 +431,13 @@ func (c *connector) tryConnect(clusterName, desktopServiceID string) (conn net.C
// proxyWebsocketConn does a bidrectional copy between the websocket
// connection to the browser (ws) and the mTLS connection to Windows
// Desktop Serivce (wds)
func proxyWebsocketConn(ws *websocket.Conn, wds net.Conn, wdsVersion string) error {
func proxyWebsocketConn(ws *websocket.Conn, wds net.Conn) error {
var closeOnce sync.Once
close := func() {
ws.Close()
wds.Close()
}

v, err := semver.NewVersion(wdsVersion)
if err != nil {
return trace.BadParameter("invalid windows desktop service version %q: %v", wdsVersion, err)
}

isPre15 := v.Major < 15

errs := make(chan error, 2)

go func() {
Expand Down Expand Up @@ -525,11 +517,6 @@ func proxyWebsocketConn(ws *websocket.Conn, wds net.Conn, wdsVersion string) err
errs <- err
return
}
// don't pass the sync keys message along to old agents
// (they don't support it)
if isPre15 && tdp.MessageType(buf[0]) == tdp.TypeSyncKeys {
continue
}

if _, err := wds.Write(buf[:n]); err != nil {
errs <- trace.Wrap(err, "sending TDP message to desktop agent")
Expand Down