From b18fccc8679c1fdfd3b36e40c0e9d38665c95b11 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 15 Sep 2020 16:53:34 +0200 Subject: [PATCH] If registration was previously ignored, then ignore it on subsequent initialization --- src/dorkbox/network/serialization/ClassRegistration.kt | 6 +++++- .../network/serialization/ClassRegistrationForRmi.kt | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/dorkbox/network/serialization/ClassRegistration.kt b/src/dorkbox/network/serialization/ClassRegistration.kt index 889caa0e..77d65dec 100644 --- a/src/dorkbox/network/serialization/ClassRegistration.kt +++ b/src/dorkbox/network/serialization/ClassRegistration.kt @@ -33,8 +33,12 @@ internal abstract class ClassRegistration(val clazz: Class<*>, val serializer: S */ open fun register(kryo: KryoExtra, rmi: RmiHolder) { // ClassRegistrationForRmi overrides this method + if (id == IGNORE_REGISTRATION) { + // we have previously specified that this registration should be ignored! + return + } - if (id != 0) { + if (id > 0) { // our ID will always be > 0 // this means that this registration was PREVIOUSLY registered on a different kryo. Shortcut the logic. diff --git a/src/dorkbox/network/serialization/ClassRegistrationForRmi.kt b/src/dorkbox/network/serialization/ClassRegistrationForRmi.kt index c68b4984..70d9b1eb 100644 --- a/src/dorkbox/network/serialization/ClassRegistrationForRmi.kt +++ b/src/dorkbox/network/serialization/ClassRegistrationForRmi.kt @@ -105,7 +105,12 @@ internal class ClassRegistrationForRmi(ifaceClass: Class<*>, */ override fun register(kryo: KryoExtra, rmi: RmiHolder) { // we override this, because we ALWAYS will call our RMI registration! - if (id != 0) { + if (id == IGNORE_REGISTRATION) { + // we have previously specified that this registration should be ignored! + return + } + + if (id > 0) { // our ID will always be > 0 // this means that this registration was PREVIOUSLY registered on a different kryo. Shortcut the logic.