AUTH-2587 add config watcher and reload logic for access client forwarder

This commit is contained in:
Dalton
2020-04-13 12:22:00 -05:00
parent 976eb24883
commit 41c358147c
32 changed files with 2929 additions and 8 deletions

View File

@@ -73,17 +73,24 @@ func StartClient(conn Connection, stream io.ReadWriter, options *StartOptions) e
// `Serve` always closes `listener`.
func Serve(remoteConn Connection, listener net.Listener, shutdownC <-chan struct{}, options *StartOptions) error {
defer listener.Close()
for {
select {
case <-shutdownC:
return nil
default:
errChan := make(chan error)
go func() {
for {
conn, err := listener.Accept()
if err != nil {
return err
errChan <- err
return
}
go serveConnection(remoteConn, conn, options)
}
}()
select {
case <-shutdownC:
return nil
case err := <-errChan:
return err
}
}