fix: cdn AdvertiseIP not used (#782)

Signed-off-by: Jim Ma <majinjing3@gmail.com>
This commit is contained in:
Jim Ma 2021-11-08 14:07:04 +08:00 committed by Gaius
parent a6b7c4697e
commit e0142cda8b
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
1 changed files with 5 additions and 2 deletions

View File

@ -14,7 +14,6 @@
* limitations under the License.
*/
// Package cdnsystem cdn server
package cdn
import (
@ -176,7 +175,11 @@ func (s *Server) Serve() error {
}
// Generate GRPC listener
lis, _, err := rpc.ListenWithPortRange(iputils.HostIP, s.config.ListenPort, s.config.ListenPort)
var listen = iputils.HostIP
if s.config.AdvertiseIP != "" {
listen = s.config.AdvertiseIP
}
lis, _, err := rpc.ListenWithPortRange(listen, s.config.ListenPort, s.config.ListenPort)
if err != nil {
logger.Fatalf("net listener failed to start: %+v", err)
}