From c9264c9ce1d71903aa9392334f2a9ce8e568c941 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 30 Nov 2021 11:55:34 +0100 Subject: [PATCH] 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. --- src/pipewire/impl-core.c | 10 ++++++---- src/pipewire/protocol.c | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pipewire/impl-core.c b/src/pipewire/impl-core.c index 1c5b54fec..85d41e7bb 100644 --- a/src/pipewire/impl-core.c +++ b/src/pipewire/impl-core.c @@ -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); diff --git a/src/pipewire/protocol.c b/src/pipewire/protocol.c index 8ffc27774..3092f2cff 100644 --- a/src/pipewire/protocol.c +++ b/src/pipewire/protocol.c @@ -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; }