From 50a4170541377287c4187b57d023450d4feb034f Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 10 Sep 2014 08:18:30 +0200 Subject: [PATCH] Announce actual port when UPnP is disabled (fixes #657) --- cmd/syncthing/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index 1bd77e84e..eff5536f5 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -530,6 +530,14 @@ nextRepo: } } + // The default port we announce, possibly modified by setupUPnP next. + + addr, err := net.ResolveTCPAddr("tcp", cfg.Options.ListenAddress[0]) + if err != nil { + l.Fatalln("Bad listen address:", err) + } + externalPort = addr.Port + // UPnP if cfg.Options.UPnPEnabled {