Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions entry_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,25 @@ func (e *entryGroups) get(containerID string) (*avahi.EntryGroup, func(), error)
return nil, func() {}, fmt.Errorf("error creating new entry group: %w", err)
}

go logStateChanges(containerID, entryGroup.StateChangeChannel)

e.groups[containerID] = entryGroup
}

return e.groups[containerID], commit, nil
}

// logStateChanges reads the state changes of an entry group. When one of
// these channels is full, go-avahi stops sending signals to all entry groups.
func logStateChanges(containerID string, states <-chan avahi.EntryGroupState) {
for state := range states {
switch state.State {
case avahi.EntryGroupCollision:
log.Logf(log.PriWarning, "Avahi name collision for container %s", containerID)
case avahi.EntryGroupFailure:
log.Logf(log.PriWarning, "Avahi registration failed for container %s: %s", containerID, state.Error)
default:
log.Logf(log.PriDebug, "Avahi entry group state for container %s: %d", containerID, state.State)
}
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/coreos/go-systemd/v22 v22.7.0
github.com/godbus/dbus/v5 v5.2.2
github.com/google/gops v0.3.29
github.com/holoplot/go-avahi v1.0.1
github.com/holoplot/go-avahi v1.1.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/moby/moby/api v1.56.0
github.com/moby/moby/client v0.6.0
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
Expand All @@ -34,8 +33,8 @@ github.com/google/gops v0.3.29 h1:n98J2qSOK1NJvRjdLDcjgDryjpIBGhbaqph1mXKL0rY=
github.com/google/gops v0.3.29/go.mod h1:8N3jZftuPazvUwtYY/ncG4iPrjp15ysNKLfq+QQPiwc=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/holoplot/go-avahi v1.0.1 h1:XcqR2keL4qWRnlxHD5CAOdWpLFZJ+EOUK0vEuylfvvk=
github.com/holoplot/go-avahi v1.0.1/go.mod h1:qH5psEKb0DK+BRplMfc+RY4VMOlbf6mqfxgpMy6aP0M=
github.com/holoplot/go-avahi v1.1.0 h1:mJIc59l8/KabNdyGJzVOD+XReJ9c5ZzI4jlQnVy5gog=
github.com/holoplot/go-avahi v1.1.0/go.mod h1:Hvjx23795uo0r4Cz1hiq8YxyGtkyBH03hz+NAcgo108=
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
Expand Down
Loading