Update event types and drop idea of global request

This commit is contained in:
Jose Garcia 2022-02-17 17:05:56 -05:00
parent ee349700de
commit 9556c72ecf
3 changed files with 2 additions and 15 deletions

View file

@ -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 {

View file

@ -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

View file

@ -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)
}