protocol-native: give an error when loading twice

Instead of silently ignoring the problem. It's possible that it is
loaded with different settings, which would then silently be ignored.
This commit is contained in:
Wim Taymans 2023-07-06 13:51:37 +02:00
parent 48a892aeec
commit fdc860c71b

View file

@ -1472,8 +1472,10 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
PW_LOG_TOPIC_INIT(mod_topic);
PW_LOG_TOPIC_INIT(mod_topic_connection);
if (pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native) != NULL)
return 0;
if (pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native) != NULL) {
pw_log_error("protocol %s is already loaded", PW_TYPE_INFO_PROTOCOL_Native);
return -EEXIST;
}
this = pw_protocol_new(context, PW_TYPE_INFO_PROTOCOL_Native, sizeof(struct protocol_data));
if (this == NULL)