core: disable bind version checks

Allow clients to bind to different versions of the server object.

When the server object is newer, it will adapt to the older version.

If the server object is older and the client tries to call a newer
method, it will receive an error. The right thing for the client is to
then ignore this and not call the method again. It should also probably
first check the server version before calling newer methods.
This commit is contained in:
Wim Taymans 2021-11-30 11:55:34 +01:00
parent cc9fbe4375
commit c9264c9ce1
2 changed files with 6 additions and 5 deletions

View file

@ -314,8 +314,10 @@ core_create_object(void *object,
if (!spa_streq(factory->info.type, type))
goto error_type;
if (factory->info.version < version)
goto error_version;
if (factory->info.version < version) {
pw_log_info("%p: version %d < %d", context,
factory->info.version, version);
}
if (props) {
properties = pw_properties_new_dict(props);
@ -325,7 +327,8 @@ core_create_object(void *object,
properties = NULL;
/* error will be posted */
obj = pw_impl_factory_create_object(factory, resource, type, version, properties, new_id);
obj = pw_impl_factory_create_object(factory, resource, type,
version, properties, new_id);
if (obj == NULL)
goto error_create_failed;
@ -336,7 +339,6 @@ error_no_factory:
pw_log_debug("%p: can't find factory '%s'", context, factory_name);
pw_resource_errorf_id(resource, new_id, res, "unknown factory name %s", factory_name);
goto error_exit;
error_version:
error_type:
res = -EPROTO;
pw_log_debug("%p: invalid resource type/version", context);

View file

@ -167,7 +167,6 @@ pw_protocol_get_marshal(struct pw_protocol *protocol, const char *type, uint32_t
spa_list_for_each(impl, &protocol->marshal_list, link) {
if (spa_streq(impl->marshal->type, type) &&
impl->marshal->version >= version &&
(impl->marshal->flags & flags) == flags)
return impl->marshal;
}