libnetwork: rename agent type to reduce collisions

There were quite some places where the type collided with variables
named `agent`. Let's rename the type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-08-16 12:12:39 +02:00
parent b3e249f401
commit e8f0f5a4ce
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 6 additions and 6 deletions

View file

@ -35,7 +35,7 @@ func (b ByTime) Len() int { return len(b) }
func (b ByTime) Swap(i, j int) { b[i], b[j] = b[j], b[i] }
func (b ByTime) Less(i, j int) bool { return b[i].LamportTime < b[j].LamportTime }
type agent struct {
type nwAgent struct {
networkDB *networkdb.NetworkDB
bindAddr string
advertiseAddr string
@ -45,7 +45,7 @@ type agent struct {
sync.Mutex
}
func (a *agent) dataPathAddress() string {
func (a *nwAgent) dataPathAddress() string {
a.Lock()
defer a.Unlock()
if a.dataPathAddr != "" {
@ -323,7 +323,7 @@ func (c *Controller) agentInit(listenAddr, bindAddrOrInterface, advertiseAddr, d
cancelList = append(cancelList, cancel)
c.mu.Lock()
c.agent = &agent{
c.agent = &nwAgent{
networkDB: nDB,
bindAddr: bindAddr,
advertiseAddr: advertiseAddr,
@ -750,7 +750,7 @@ func (ep *Endpoint) deleteServiceInfoFromCluster(sb *Sandbox, fullRemove bool, m
return nil
}
func disableServiceInNetworkDB(a *agent, n *Network, ep *Endpoint) {
func disableServiceInNetworkDB(a *nwAgent, n *Network, ep *Endpoint) {
var epRec EndpointRecord
log.G(context.TODO()).Debugf("disableServiceInNetworkDB for %s %s", ep.svcName, ep.ID())

View file

@ -101,7 +101,7 @@ type Controller struct {
defOsSbox osl.Sandbox
ingressSandbox *Sandbox
sboxOnce sync.Once
agent *agent
agent *nwAgent
networkLocker *locker.Locker
agentInitDone chan struct{}
agentStopDone chan struct{}
@ -213,7 +213,7 @@ func (c *Controller) SetKeys(keys []*types.EncryptionKey) error {
return c.handleKeyChange(keys)
}
func (c *Controller) getAgent() *agent {
func (c *Controller) getAgent() *nwAgent {
c.mu.Lock()
defer c.mu.Unlock()
return c.agent