support existing connections for port forwarding
This commit is contained in:
parent
79111d85ac
commit
269196c94f
1 changed files with 6 additions and 1 deletions
|
|
@ -54,7 +54,12 @@ func (l *PortForwarder) Start(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (l *PortForwarder) handleConnection(ctx context.Context, conn net.Conn) {
|
||||
func (l *PortForwarder) StartWithConn(ctx context.Context, conn io.ReadWriteCloser) error {
|
||||
go l.handleConnection(ctx, conn)
|
||||
return <-l.errCh
|
||||
}
|
||||
|
||||
func (l *PortForwarder) handleConnection(ctx context.Context, conn io.ReadWriteCloser) {
|
||||
channel, err := l.client.openStreamingChannel(ctx, l.server.streamName, l.server.streamCondition)
|
||||
if err != nil {
|
||||
l.errCh <- fmt.Errorf("error opening streaming channel for new connection: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue