Skip to content

Commit

Permalink
chore: add more debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
d--j committed Apr 17, 2023
1 parent b90899f commit 77c3e53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func emailWithoutExtension(local string, asciiDomain string) string {
}

func (c *Configuration) ResolveForward(email *addr.RcptTo) (emails []*addr.RcptTo) {
return c.resolveForward(email, make(map[string]bool))
seen := make(map[string]bool)
return c.resolveForward(email, seen)
}

func (c *Configuration) resolveForward(email *addr.RcptTo, seen map[string]bool) (emails []*addr.RcptTo) {
Expand All @@ -106,7 +107,8 @@ func (c *Configuration) resolveForward(email *addr.RcptTo, seen map[string]bool)
return []*addr.RcptTo{email}
}
for _, a := range addresses {
if !seen[a.Address] {
Log.Debug("forward res", "from", email.Addr, "to", a.Address, "seen", seen[a.Address])
if !(seen[a.Address]) {
seen[a.Address] = true
for _, r := range c.resolveForward(addr.NewRcptTo(a.Address, "", email.Transport()), seen) {
emails = append(emails, r)
Expand Down

0 comments on commit 77c3e53

Please sign in to comment.