Use msgpack and remove serpent's bytes workaround
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sat, 20 May 2023 00:33:22 +0200
changeset 3808 3e219f00151a
parent 3807 87f670154294
child 3809 45accb98d761
Use msgpack and remove serpent's bytes workaround
connectors/ConnectorBase.py
connectors/PYRO/__init__.py
runtime/PLCObject.py
runtime/PyroServer.py
--- a/connectors/ConnectorBase.py	Thu May 18 00:04:03 2023 +0200
+++ b/connectors/ConnectorBase.py	Sat May 20 00:33:22 2023 +0200
@@ -14,7 +14,7 @@
     def BlobFromFile(self, filepath, seed):
         s = hashlib.new('md5')
         s.update(seed.encode())
-        blobID = self.SeedBlob(seed)
+        blobID = self.SeedBlob(seed.encode())
         with open(filepath, "rb") as f:
             while blobID == s.digest():
                 chunk = f.read(self.chuncksize)
--- a/connectors/PYRO/__init__.py	Thu May 18 00:04:03 2023 +0200
+++ b/connectors/PYRO/__init__.py	Sat May 20 00:33:22 2023 +0200
@@ -38,7 +38,8 @@
 import importlib
 
 
-Pyro5.config.SERPENT_BYTES_REPR = True
+Pyro5.config.SERIALIZER = "msgpack"
+
 
 def PYRO_connector_factory(uri, confnodesroot):
     """
--- a/runtime/PLCObject.py	Thu May 18 00:04:03 2023 +0200
+++ b/runtime/PLCObject.py	Sat May 20 00:33:22 2023 +0200
@@ -574,7 +574,7 @@
     def SeedBlob(self, seed):
         blob = (mkstemp(dir=self.tmpdir) + (hashlib.new('md5'),))
         _fd, _path, md5sum = blob
-        md5sum.update(seed.encode())
+        md5sum.update(seed)
         newBlobID = md5sum.digest()
         self.blobs[newBlobID] = blob
         return newBlobID
--- a/runtime/PyroServer.py	Thu May 18 00:04:03 2023 +0200
+++ b/runtime/PyroServer.py	Sat May 20 00:33:22 2023 +0200
@@ -20,6 +20,8 @@
 import runtime
 from runtime.ServicePublisher import ServicePublisher
 
+Pyro5.config.SERIALIZER = "msgpack"
+
 def make_pyro_exposed_stub(method_name):
     stub = lambda self, *args, **kwargs: \
         getattr(self.plc_object_instance, method_name)(*args, **kwargs)