From 9556c72ecfd61dd06aaae471ee65c7e5f39df135 Mon Sep 17 00:00:00 2001 From: Jose Garcia Date: Thu, 17 Feb 2022 17:05:56 -0500 Subject: [PATCH] Update event types and drop idea of global request --- pkg/cmd/codespace/ports.go | 4 ++-- pkg/liveshare/rpc.go | 3 --- pkg/liveshare/ssh.go | 10 ---------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/pkg/cmd/codespace/ports.go b/pkg/cmd/codespace/ports.go index 3b698494a..76ad97d74 100644 --- a/pkg/cmd/codespace/ports.go +++ b/pkg/cmd/codespace/ports.go @@ -273,8 +273,8 @@ func (a *App) UpdatePortVisibility(ctx context.Context, codespaceName string, ar } defer safeClose(session, &err) - success := session.RegisterEvent("sharingSucceeded") - failure := session.RegisterEvent("sharingFailed") + success := session.RegisterEvent("serverSharing.sharingSucceeded") + failure := session.RegisterEvent("serverSharing.sharingFailed") // TODO: check if port visibility can be updated in parallel instead of sequentially for _, port := range ports { diff --git a/pkg/liveshare/rpc.go b/pkg/liveshare/rpc.go index e50e2576b..b5d520313 100644 --- a/pkg/liveshare/rpc.go +++ b/pkg/liveshare/rpc.go @@ -73,9 +73,6 @@ func (r *requestHandler) eventHandler(eventName string) chan []byte { func (r *requestHandler) Handle(ctx context.Context, conn *jsonrpc2.Conn, req *jsonrpc2.Request) { fmt.Println(req.Method) - if req.Params != nil { - fmt.Println(string(*req.Params)) - } handler := r.eventHandler(req.Method) if handler == nil { return // noop diff --git a/pkg/liveshare/ssh.go b/pkg/liveshare/ssh.go index ec32671be..e7de9055a 100644 --- a/pkg/liveshare/ssh.go +++ b/pkg/liveshare/ssh.go @@ -50,7 +50,6 @@ func (s *sshSession) connect(ctx context.Context) error { return fmt.Errorf("error creating ssh client connection: %w", err) } s.conn = sshClientConn - go s.handleGlobalRequests(reqs) sshClient := ssh.NewClient(sshClientConn, chans, reqs) s.Session, err = sshClient.NewSession() @@ -71,15 +70,6 @@ func (s *sshSession) connect(ctx context.Context) error { return nil } -func (s *sshSession) handleGlobalRequests(incoming <-chan *ssh.Request) { - for r := range incoming { - fmt.Println(r.Type) - // This handles keepalive messages and matches - // the behaviour of OpenSSH. - r.Reply(false, nil) - } -} - func (s *sshSession) Read(p []byte) (n int, err error) { return s.reader.Read(p) }