@@ -457,6 +457,8 @@ func (c *Client) NamespaceService() namespaces.Store {
457457 if c .namespaceStore != nil {
458458 return c .namespaceStore
459459 }
460+ c .connMu .Lock ()
461+ defer c .connMu .Unlock ()
460462 return NewNamespaceStoreFromClient (namespacesapi .NewNamespacesClient (c .conn ))
461463}
462464
@@ -465,6 +467,8 @@ func (c *Client) ContainerService() containers.Store {
465467 if c .containerStore != nil {
466468 return c .containerStore
467469 }
470+ c .connMu .Lock ()
471+ defer c .connMu .Unlock ()
468472 return NewRemoteContainerStore (containersapi .NewContainersClient (c .conn ))
469473}
470474
@@ -473,6 +477,8 @@ func (c *Client) ContentStore() content.Store {
473477 if c .contentStore != nil {
474478 return c .contentStore
475479 }
480+ c .connMu .Lock ()
481+ defer c .connMu .Unlock ()
476482 return contentproxy .NewContentStore (contentapi .NewContentClient (c .conn ))
477483}
478484
@@ -481,6 +487,8 @@ func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter {
481487 if c .snapshotters != nil {
482488 return c .snapshotters [snapshotterName ]
483489 }
490+ c .connMu .Lock ()
491+ defer c .connMu .Unlock ()
484492 return snproxy .NewSnapshotter (snapshotsapi .NewSnapshotsClient (c .conn ), snapshotterName )
485493}
486494
@@ -489,6 +497,8 @@ func (c *Client) TaskService() tasks.TasksClient {
489497 if c .taskService != nil {
490498 return c .taskService
491499 }
500+ c .connMu .Lock ()
501+ defer c .connMu .Unlock ()
492502 return tasks .NewTasksClient (c .conn )
493503}
494504
@@ -497,6 +507,8 @@ func (c *Client) ImageService() images.Store {
497507 if c .imageStore != nil {
498508 return c .imageStore
499509 }
510+ c .connMu .Lock ()
511+ defer c .connMu .Unlock ()
500512 return NewImageStoreFromClient (imagesapi .NewImagesClient (c .conn ))
501513}
502514
@@ -505,11 +517,15 @@ func (c *Client) DiffService() DiffService {
505517 if c .diffService != nil {
506518 return c .diffService
507519 }
520+ c .connMu .Lock ()
521+ defer c .connMu .Unlock ()
508522 return NewDiffServiceFromClient (diffapi .NewDiffClient (c .conn ))
509523}
510524
511525// IntrospectionService returns the underlying Introspection Client
512526func (c * Client ) IntrospectionService () introspectionapi.IntrospectionClient {
527+ c .connMu .Lock ()
528+ defer c .connMu .Unlock ()
513529 return introspectionapi .NewIntrospectionClient (c .conn )
514530}
515531
@@ -518,11 +534,15 @@ func (c *Client) LeasesService() leases.Manager {
518534 if c .leasesService != nil {
519535 return c .leasesService
520536 }
537+ c .connMu .Lock ()
538+ defer c .connMu .Unlock ()
521539 return leasesproxy .NewLeaseManager (leasesapi .NewLeasesClient (c .conn ))
522540}
523541
524542// HealthService returns the underlying GRPC HealthClient
525543func (c * Client ) HealthService () grpc_health_v1.HealthClient {
544+ c .connMu .Lock ()
545+ defer c .connMu .Unlock ()
526546 return grpc_health_v1 .NewHealthClient (c .conn )
527547}
528548
@@ -531,11 +551,15 @@ func (c *Client) EventService() EventService {
531551 if c .eventService != nil {
532552 return c .eventService
533553 }
554+ c .connMu .Lock ()
555+ defer c .connMu .Unlock ()
534556 return NewEventServiceFromClient (eventsapi .NewEventsClient (c .conn ))
535557}
536558
537559// VersionService returns the underlying VersionClient
538560func (c * Client ) VersionService () versionservice.VersionClient {
561+ c .connMu .Lock ()
562+ defer c .connMu .Unlock ()
539563 return versionservice .NewVersionClient (c .conn )
540564}
541565
0 commit comments