plugins: don't panic on Close if PluginServer nil

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
(cherry picked from commit 9c4480604e)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Laura Brehm
2024-08-09 10:48:40 +02:00
committed by Paweł Gronowski
parent 30c7951192
commit 984ef9072c
2 changed files with 15 additions and 0 deletions
+3
View File
@@ -95,6 +95,9 @@ func (pl *PluginServer) Addr() net.Addr {
//
// The error value is that of the underlying [net.Listner.Close] call.
func (pl *PluginServer) Close() error {
if pl == nil {
return nil
}
logrus.Trace("Closing plugin server")
// Close connections first to ensure the connections get io.EOF instead
// of a connection reset.