From 268cfaafb954e9a55b2dec77c9790f3f9ebaf2b3 Mon Sep 17 00:00:00 2001 From: Torben Schmitz Date: Wed, 22 Oct 2025 08:07:39 -0700 Subject: [PATCH] Configure communicator before installing services Services may use the `GetFileIfModified` function as soon as they are started, which will fail if the communicator has not been configured by that time. PiperOrigin-RevId: 822594134 --- fleetspeak/src/client/client.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/fleetspeak/src/client/client.go b/fleetspeak/src/client/client.go index ac307350..3f4f0fa0 100644 --- a/fleetspeak/src/client/client.go +++ b/fleetspeak/src/client/client.go @@ -173,6 +173,16 @@ func New(cfg config.Configuration, cmps Components) (*Client, error) { ssd.processingLoop(context.TODO()) }() + if ret.com != nil { + cctx := commsContext{c: ret} + if err := ret.com.Setup(cctx); err != nil { + ssd.stop() + return nil, fmt.Errorf("unable to configure communicator: %v", err) + } + ret.com.Start() + ssd.service.(*systemService).pollRevokedCerts() + } + for _, s := range cfg.FixedServices { if err := ret.sc.InstallService(s, nil); err != nil { log.Errorf("Unable to install fixed service [%s]: %v", s.Name, err) @@ -199,15 +209,6 @@ func New(cfg config.Configuration, cmps Components) (*Client, error) { } } - if ret.com != nil { - cctx := commsContext{c: ret} - if err := ret.com.Setup(cctx); err != nil { - ssd.stop() - return nil, fmt.Errorf("unable to configure communicator: %v", err) - } - ret.com.Start() - ssd.service.(*systemService).pollRevokedCerts() - } cm.Sync() cm.SendConfigUpdate() return ret, nil