Skip to content

Commit bbbe67d

Browse files
torsmcopybara-github
authored andcommitted
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: 822120915
1 parent 5dc19cc commit bbbe67d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

fleetspeak/src/client/client.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ func New(cfg config.Configuration, cmps Components) (*Client, error) {
173173
ssd.processingLoop(context.TODO())
174174
}()
175175

176+
if ret.com != nil {
177+
cctx := commsContext{c: ret}
178+
if err := ret.com.Setup(cctx); err != nil {
179+
ssd.stop()
180+
return nil, fmt.Errorf("unable to configure communicator: %v", err)
181+
}
182+
ret.com.Start()
183+
ssd.service.(*systemService).pollRevokedCerts()
184+
}
185+
176186
for _, s := range cfg.FixedServices {
177187
if err := ret.sc.InstallService(s, nil); err != nil {
178188
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) {
199209
}
200210
}
201211

202-
if ret.com != nil {
203-
cctx := commsContext{c: ret}
204-
if err := ret.com.Setup(cctx); err != nil {
205-
ssd.stop()
206-
return nil, fmt.Errorf("unable to configure communicator: %v", err)
207-
}
208-
ret.com.Start()
209-
ssd.service.(*systemService).pollRevokedCerts()
210-
}
211212
cm.Sync()
212213
cm.SendConfigUpdate()
213214
return ret, nil

0 commit comments

Comments
 (0)