From af4d9767c24f22a15e894c244966f67b33dfff0f Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Tue, 30 Nov 2021 19:26:07 +0800 Subject: [PATCH] Fix: slave node cannot transfer files to other slave node --- pkg/filesystem/filesystem.go | 3 --- pkg/filesystem/filesystem_test.go | 14 +++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pkg/filesystem/filesystem.go b/pkg/filesystem/filesystem.go index 7f176c0..9ca9d48 100644 --- a/pkg/filesystem/filesystem.go +++ b/pkg/filesystem/filesystem.go @@ -247,9 +247,6 @@ func (fs *FileSystem) SwitchToSlaveHandler(node cluster.Node) { // SwitchToShadowHandler 将负责上传的 Handler 切换为从机节点转存使用的影子处理器 func (fs *FileSystem) SwitchToShadowHandler(master cluster.Node, masterURL, masterID string) { switch fs.Policy.Type { - case "remote": - fs.Policy.Type = "local" - fs.DispatchHandler() case "local": fs.Policy.Type = "remote" fs.Policy.Server = masterURL diff --git a/pkg/filesystem/filesystem_test.go b/pkg/filesystem/filesystem_test.go index e071ece..0c558d7 100644 --- a/pkg/filesystem/filesystem_test.go +++ b/pkg/filesystem/filesystem_test.go @@ -292,17 +292,17 @@ func TestFileSystem_SwitchToShadowHandler(t *testing.T) { Model: &model.Node{}, } - // remote to local - { - fs.Policy.Type = "remote" - fs.SwitchToShadowHandler(mockNode, "", "") - a.IsType(&masterinslave.Driver{}, fs.Handler) - } - // local to remote { fs.Policy.Type = "local" fs.SwitchToShadowHandler(mockNode, "", "") a.IsType(&masterinslave.Driver{}, fs.Handler) } + + // onedrive + { + fs.Policy.Type = "onedrive" + fs.SwitchToShadowHandler(mockNode, "", "") + a.IsType(&masterinslave.Driver{}, fs.Handler) + } }