Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert additional stream closed polling on proxy command #802

Merged
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
22 changes: 0 additions & 22 deletions pkg/granted/proxy/listenandproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package proxy

import (
"context"
"errors"
"fmt"
"io"
"net"
"time"

"github.com/common-fate/clio"
"github.com/common-fate/clio/clierr"
Expand Down Expand Up @@ -95,26 +93,6 @@ func ListenAndProxy(ctx context.Context, yamuxStreamConnection *yamux.Session, c
}

}()

// This function polls the stream connection to see if it has been closed remotely
// https://github.com/hashicorp/yamux/pull/115
// when the proxy server has errors which are fatal to this session, it will close the stream
go func() {
defer clientConn.Close()
defer sessionConn.Close()
for {
b := make([]byte, 0)
_, err := sessionConn.Read(b)
if err != nil {
if errors.Is(err, io.EOF) {
clio.Infof("The proxy server ended the connection for the session unexpectedly [%v]", sessionConn.StreamID())
return
}
}
time.Sleep(time.Second)
}

}()
}(result.conn)
}
}
Expand Down
Loading