Dedup protocol registration

This commit is contained in:
Jinqiu Yu
2018-03-06 15:24:52 +08:00
parent 8c499d8fd2
commit 794dfd5bf3
+3 -1
View File
@@ -10,7 +10,9 @@ var (
)
func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error {
// TODO: check duplicate
if _, found := globalTransportConfigCreatorCache[protocol]; found {
return newError("protocol: " + TransportProtocol_name[int32(protocol)]+ " is already registered").AtError()
}
globalTransportConfigCreatorCache[protocol] = creator
return nil
}