From b7bb3bfee2861bfb459e66228bd2d9c0fe735149 Mon Sep 17 00:00:00 2001 From: Caleb Callaway Date: Wed, 22 Oct 2014 19:09:17 -0700 Subject: [PATCH] UPnP discovery fix for devices that send multiple response packets Fix UPnP discovery and port mapping issues reported in #896 --- internal/upnp/upnp.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/upnp/upnp.go b/internal/upnp/upnp.go index 8d2746b6..959e26ce 100644 --- a/internal/upnp/upnp.go +++ b/internal/upnp/upnp.go @@ -210,6 +210,17 @@ Mx: %d // Collect our results from the result handlers using the result channel for result := range resultChannel { + // Check for existing results (some routers send multiple response packets) + for _, existingResult := range results { + if existingResult.uuid == result.uuid { + if debug { + l.Debugln("Already processed device with UUID", existingResult.uuid, "continuing...") + } + continue + } + } + + // No existing results, okay to append results = append(results, result) }