Remove ALPN Muxer (#1965)
We never ended up using this and it makes it much harder to reason about the listeners. An explanation: for the moment I separated out all of the listeners in the struct, even though one should suffice, because when I did it that way first I was hitting some really weird and hard to find intermittent behavior where it seemed like the listeners were getting crossed. So I re-did it this way with each listener very explicitly referenced. I'm happy to make a follow-up PR that attempts to combine them all into a single listener without hitting the issues I did, if desired, but at least doing it via a separate PR means that it won't be something with removing the ALPN muxer that is at fault.
This commit is contained in:
1 parent
ce7292d9c8
commit
07dc3db974
13 files changed
+191
-832
No files matched your search
@@ -381,7 +381,18 @@ func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allo
|
||||
// we ignore errors
|
||||
b.ShutdownFuncs = append(b.ShutdownFuncs, func() error {
|
||||
for _, ln := range b.Listeners {
|
||||
ln.Mux.Close()
|
||||
if ln.ProxyListener != nil {
|
||||
ln.ProxyListener.Close()
|
||||
}
|
||||
if ln.ClusterListener != nil {
|
||||
ln.ClusterListener.Close()
|
||||
}
|
||||
if ln.ApiListener != nil {
|
||||
ln.ApiListener.Close()
|
||||
}
|
||||
if ln.OpsListener != nil {
|
||||
ln.OpsListener.Close()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@@ -414,7 +425,7 @@ func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allo
|
||||
}
|
||||
}
|
||||
|
||||
lnMux, props, reloadFunc, err := NewListener(lnConfig, ui)
|
||||
ln, props, reloadFunc, err := NewListener(lnConfig, ui)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error initializing listener of type %s: %w", lnConfig.Type, err)
|
||||
}
|
||||
@@ -460,10 +471,22 @@ func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allo
|
||||
}
|
||||
props["max_request_duration"] = lnConfig.MaxRequestDuration.String()
|
||||
|
||||
b.Listeners = append(b.Listeners, &ServerListener{
|
||||
Mux: lnMux,
|
||||
serverListener := &ServerListener{
|
||||
Config: lnConfig,
|
||||
})
|
||||
}
|
||||
|
||||
switch purpose {
|
||||
case "api":
|
||||
serverListener.ApiListener = ln
|
||||
case "cluster":
|
||||
serverListener.ClusterListener = ln
|
||||
case "proxy":
|
||||
serverListener.ProxyListener = ln
|
||||
case "ops":
|
||||
serverListener.OpsListener = ln
|
||||
}
|
||||
|
||||
b.Listeners = append(b.Listeners, serverListener)
|
||||
|
||||
props["purpose"] = strings.Join(lnConfig.Purpose, ",")
|
||||
|
||||
|
||||
Reference in new issue
Block a user