feat: IPC port is now verified on update.

feat: A wrong ip is filled with the default one 127.0.0.1
This commit is contained in:
Swann
2020-07-02 10:12:08 +02:00
parent b2d1cec7f4
commit 0e8bdf7fe5

View File

@ -53,6 +53,15 @@ def update_ip(self, context):
self['ip'] = ip.group()
else:
logging.error("Wrong IP format")
self['ip'] = "127.0.0.1"
def update_port(self, context):
max_port = self.port + 3
if self.ipc_port < max_port and \
self['ipc_port'] >= self.port:
logging.error("IPC Port in conflic with the port, assigning a random value")
self['ipc_port'] = random.randrange(self.port+4, 10000)
class ReplicatedDatablock(bpy.types.PropertyGroup):
type_name: bpy.props.StringProperty()
@ -101,7 +110,8 @@ class SessionPrefs(bpy.types.AddonPreferences):
ipc_port: bpy.props.IntProperty(
name="ipc_port",
description='internal ttl port(only usefull for multiple local instances)',
default=5561
default=5561,
update=update_port
)
init_method: bpy.props.EnumProperty(
name='init_method',