Merge pull request #265 from flycash/bug/reverseRegistryProtocol
Fix: Revert the registryProtocol.GetProtocol() to its original codes
diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go
index ffdb275..534a4b9 100644
--- a/registry/protocol/protocol.go
+++ b/registry/protocol/protocol.go
@@ -338,10 +338,10 @@
}
func GetProtocol() protocol.Protocol {
- if regProtocol == nil {
- regProtocol = newRegistryProtocol()
+ if regProtocol != nil {
+ return regProtocol
}
- return regProtocol
+ return newRegistryProtocol()
}
type wrappedInvoker struct {
diff --git a/registry/protocol/protocol_test.go b/registry/protocol/protocol_test.go
index 761d140..0c19da5 100644
--- a/registry/protocol/protocol_test.go
+++ b/registry/protocol/protocol_test.go
@@ -291,8 +291,3 @@
v2, _ := regProtocol.bounds.Load(getCacheKey(newUrl))
assert.NotNil(t, v2)
}
-
-func TestGetProtocol(t *testing.T) {
- singleton := GetProtocol()
- assert.True(t, singleton == GetProtocol())
-}