浏览代码

Announce actual port when UPnP is disabled (fixes #657)

Jakob Borg 11 年之前
父节点
当前提交
50a4170541
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      cmd/syncthing/main.go

+ 8 - 0
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 {