From a67e9388758c012e22824314ce13cf86a397eb8a Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 4 Mar 2021 01:48:10 -0800 Subject: [PATCH] allocate yp at launch to allow for enabling it later --- core/core.go | 4 +--- yp/yp.go | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/core.go b/core/core.go index 938b83cba..3d3010b9c 100644 --- a/core/core.go +++ b/core/core.go @@ -63,9 +63,7 @@ func Start() error { return err } - if data.GetDirectoryEnabled() { - _yp = yp.NewYP(GetStatus) - } + _yp = yp.NewYP(GetStatus) chat.Setup(ChatListenerImpl{}) diff --git a/yp/yp.go b/yp/yp.go index 2fd8955b2..7f7102fd5 100644 --- a/yp/yp.go +++ b/yp/yp.go @@ -60,6 +60,10 @@ func (yp *YP) Stop() { } func (yp *YP) ping() { + if !data.GetDirectoryEnabled() { + return + } + myInstanceURL := data.GetServerURL() if myInstanceURL == "" { log.Warnln("Server URL not set in the configuration. Directory access is disabled until this is set.")