summaryrefslogtreecommitdiff
path: root/gdbus/client.c
Commit message (Collapse)AuthorAgeFilesLines
* gdbus: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- GPL-2.0-or-later : 6 License: GPL-2.0-or-later gdbus/mainloop.c gdbus/object.c gdbus/polkit.c gdbus/client.c gdbus/watch.c gdbus/gdbus.h
* gdbus: Make g_dbus_proxy_get_path take const proxyLuiz Augusto von Dentz2020-09-141-1/+1
| | | | | This makes g_dbus_proxy_get_path take const proxy since it doesn't change anything on the proxy and avoid pointless casts.
* build: Move declaration of _GNU_SOURCE back into individual source filesMarcel Holtmann2018-12-061-0/+1
|
* gdbus: Introduce functions appending to dbus messageERAMOTO Masaya2018-03-011-38/+97
|
* client: Use g_dbus_proxy_path_lookup()ERAMOTO Masaya2018-01-021-1/+0
|
* gdbus: Introduce g_dbus_proxy_path_lookup()ERAMOTO Masaya2018-01-021-0/+21
| | | | | | g_dbus_proxy_path_lookup() returns the path of the proxy that matches the passed path. It also returns the index of the proxy coming next to the matched proxy in the passed list.
* gdbus: Make proxy_lookup() globalERAMOTO Masaya2018-01-021-6/+16
| | | | | | | Also adds the following feature to g_dbus_proxy_lookup(). - It is more robust even if a proxy is NULL. - It checks if the passed interface is NULL. - It looks up from the position of the list specified by the index.
* gdbus: Fix crash on proxy removeSzymon Janc2017-12-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | If proxy was freed due to interface being removed remaining references are left with NULL client pointer. We need to cancel pending calls that require client when getting reply. This fix following crash: bluetoothd[2773]: src/gatt-database.c:proxy_removed_cb() Proxy removed - removing service: /test/app/hci0/service2 bluetoothd[2773]: src/gatt-database.c:gatt_db_service_removed() Local GATT service removed bluetoothd[2773]: src/adapter.c:adapter_service_remove() /org/bluez/hci0 bluetoothd[2773]: src/adapter.c:remove_uuid() sending remove uuid command for index 0 bluetoothd[2773]: src/sdpd-service.c:remove_record_from_server() Removing record with handle 0x10008 bluetoothd[2773]: src/gatt-database.c:client_disconnect_cb() Client disconnected ==2773== Invalid read of size 8 ==2773== at 0x485220: proxy_added (client.c:288) ==2773== by 0x485220: get_all_properties_reply (client.c:316) ==2773== by 0x515A041: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6) ==2773== by 0x515DA60: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6) ==2773== by 0x47F2BF: message_dispatch (mainloop.c:72) ==2773== by 0x4E84049: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==2773== by 0x4E843EF: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==2773== by 0x4E84711: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) ==2773== by 0x40B51F: main (main.c:770) ==2773== Address 0x88 is not stack'd, malloc'd or (recently) free'd
* gdbus: Force service to start if proxy is created while not connectedLuiz Augusto von Dentz2017-11-281-1/+28
| | | | | Because GetAll is no longer send right away the service may never be started.
* gdbus: Fix not always appending proxy to the listLuiz Augusto von Dentz2017-08-221-3/+3
| | | | | | | Changes introduced by ef024c2c44b4f0dab3c054d062a911cacef1fdc9 have a regression were a proxy may not be appended to the proxy_list causing tests to fail as the proxies maybe be added multiple time since proxy_look would not be able to find existing instances.
* gdbus: Fix calling GetAll while GetManagedObjects is pendingLuiz Augusto von Dentz2017-08-151-37/+58
| | | | | | If proxies are created while the client is not ready put them into a pending list so only if they are not found in GetManagedObject reply call GetAll.
* gdbus/client: Use g_dbus_send_message if callback is not setLuiz Augusto von Dentz2016-03-081-12/+14
| | | | | If the user don't set a function it means it doesn't care about the reply so g_dbus_send_message can be used.
* gdbus/client: Always call ready callbackLuiz Augusto von Dentz2016-01-071-3/+3
| | | | | | Call ready callback regardless of the reply to GetManagedObjects since otherwise the user code will be left waiting forever when in fact no proxy will be created.
* gdbus: Make GDBusClient work without ObjectManagerLuiz Augusto von Dentz2015-03-251-2/+7
| | | | This makes GDBusClient work normally without ObjectManager.
* gdbus/client: Allow specifying ObjectManager pathArman Uguray2015-02-271-6/+18
| | | | | | | | GDBusClient currently hard-codes "/" as the remote ObjectManager path. This is generally incorrect, as an application can choose to expose an ObjectManager at any well-known path. This patch fixes this by allowing the user to pass in the ObjectManager path by introducing a new conctructor "g_dbus_client_new_full".
* gdbus/client: Don't GetManagedObjects w/o handlersArman Uguray2015-02-271-1/+2
| | | | | | | | The client code currently issues GetManagedObjects if new handlers are set via g_dbus_client_set_proxy_handlers. An application may set these to NULL before unref'ing a client or to simply prevent further events. Hence, there is no need to refresh objects or properties if all handlers are NULL.
* gdbus: Don't refresh objects/props if disconnectedArman Uguray2015-02-221-5/+8
| | | | | | | | If g_dbus_client_set_proxy_handlers gets called from within a proxy_removed callback, the code may end up refreshing the proxy's properties and incorrectly access the client's proxy_list as it gets freed. This patch fixes this, so that get_managed_objects does nothing if it gets called during a service disconnect.
* gdbus: Avoid reporting GDBusClient disconnect twiceClaudio Takahasi2014-04-031-2/+12
| | | | | | | | | | No matter if disconnection was reported previously, g_dbus_client_unref() was always calling service disconnect callback. This patch fix the following scenario: 1) service disconnects from the bus 2) disconnect callback gets called 3) client calls g_dbus_client_unref(), disconnect callback is called again.
* gdbus: Add g_dbus_proxy_set_property_arrayClaudio Takahasi2014-03-241-0/+87
| | | | | This patch adds a new gdbus utility function to allow setting a property of fixed, and non-fixed values array.
* gdbus: Add g_dbus_client_set_ready_watch()Claudio Takahasi2014-03-061-0/+17
| | | | | | This patch adds a new gdbus helper to notify the clients that GetManagedObjects reply was received and the last proxy has been informed previously by the proxy_added callback.
* gdbus: Remove not needed check for NULL DBusPendingCallSzymon Janc2013-10-141-5/+0
| | | | | It is now checked by g_dbus_send_message_with_reply() so there is no need to double check that in caller.
* gdbus/client: Use g_dbus_add_properties_watch to track propertiesLuiz Augusto von Dentz2013-09-121-79/+56
| | | | | This make the handling much simpler and avoids duplicates of the same match rule.
* gdbus/client: Use g_dbus_add_signal_watch to track signalsLuiz Augusto von Dentz2013-09-121-36/+37
| | | | | This make the handling much simpler and avoids duplicates of the same match rule.
* gdbus/client: Use g_dbus_add_service_watch to track servicesLuiz Augusto von Dentz2013-09-121-135/+38
| | | | | This make the handling much simpler and avoids duplicates of the same match rule.
* gdbus: Avoid calling dbus_connection_send*Luiz Augusto von Dentz2013-09-091-7/+7
| | | | | dbus_connection_send* should not be called directly except by g_dbus_send_message.
* gdbus: Remove proxies when client disconnectsHenrique Dante de Almeida2013-05-281-0/+4
| | | | | | | | | | | | | | | Remove proxies and generate proxy_removed callbacks even when there are no corresponding InterfaceRemoved signals. This patch fixes having zombie gdbus proxy object when a server disconnects without sending InterfaceRemoved signals. These objects may interact with new server instances, for example, making InterfaceAdded signals of new objects with the same name be filtered out as duplicated, or staying allocated, but unused, if the new server doesn't reuse the object paths. Note that as a side-effect, the lifetime of a gdbus proxy becomes stricter: it lives at most for the duration of a single connection to a single instance of a server process.
* gdbus: Fix using NULL DBusPendingCall when disconnected from D-BusAnderson Lizardo2013-05-081-0/+5
| | | | | | | | | | | | | | | | | | | | From D-Bus documentation for dbus_connection_send_with_reply(): "Warning: if the connection is disconnected or you try to send Unix file descriptors on a connection that does not support them, the DBusPendingCall will be set to NULL, so be careful with this." Fix these errors when killing D-Bus daemon with the client still running: process 5712: arguments to dbus_pending_call_set_notify() were incorrect, assertion "pending != NULL" failed in file ../../dbus/dbus-pending-call.c line 596. This is normally a bug in some application using the D-Bus library. process 5712: arguments to dbus_pending_call_unref() were incorrect, assertion "pending != NULL" failed in file ../../dbus/dbus-pending-call.c line 572. This is normally a bug in some application using the D-Bus library.
* gdbus: Fix segfault when D-Bus daemon exitsAnderson Lizardo2013-05-081-0/+2
| | | | | | | | | | | | | | | | | | | | | Fix this crash if D-Bus exits while the client is still connected to it: ==5570== Invalid read of size 1 ==5570== at 0x402D28E: strcmp (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==5570== by 0x4070E22: g_str_equal (ghash.c:1704) ==5570== by 0x8055F61: message_filter (client.c:1123) ==5570== by 0x4141500: dbus_connection_dispatch (in /lib/i386-linux-gnu/libdbus-1.so.3.5.8) ==5570== by 0x80506F7: message_dispatch (mainloop.c:76) ==5570== by 0x4081A7E: g_timeout_dispatch (gmain.c:3882) ==5570== by 0x4080D85: g_main_context_dispatch (gmain.c:2539) ==5570== by 0x4081124: g_main_context_iterate.isra.21 (gmain.c:3146) ==5570== by 0x408156A: g_main_loop_run (gmain.c:3340) ==5570== by 0x41BF4D2: (below main) (libc-start.c:226) ==5570== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==5570== ==5570==
* gdbus: Fix calling GetManagedObjects twice in a rowLuiz Augusto von Dentz2013-05-031-7/+18
| | | | | | | Calling g_dbus_client_new followed by g_dbus_client_set_proxy_handlers cause two calls to GetManagedObjects in a row as GetNameOwner reply is asyncronously it triggers the second call because the handlers have been set by g_dbus_client_set_proxy_handlers.
* gdbus: Use gcc builtin instead of g_atomicLucas De Marchi2013-04-091-6/+6
| | | | | | | | | g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to -Wunused-local-typedefs. gdbus/client.c: In function ‘g_dbus_client_ref’: /usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs] #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
* gdbus: Fix not calling property_changed callbackLuiz Augusto von Dentz2013-02-281-13/+10
| | | | | | In case a property did not appear by the time proxy_added was called property_changed has to be called if it appear latter otherwise the application will be unaware of it.
* gdbus: Add g_dbus_proxy_set_removed_watchDenis Kenzior2013-02-151-0/+17
|
* gdbus: Don't call property changed callback during client initMarcel Holtmann2013-02-111-9/+10
| | | | | | | When the client uses ObjectManager to init properties, do not call property changed callbacks. They should only be called once the proxy added has been successfully signaled since the proxy itself provides a full copy of available properties.
* gdbus: Hold client reference during get name owner replyMarcel Holtmann2013-01-021-0/+4
|
* gdbus: Update properties on D-Bus client re-connectionsMarcel Holtmann2012-12-291-4/+22
|
* gdbus: Add function to manually refresh propertiesMarcel Holtmann2012-12-291-0/+83
|
* gdbus: Add support for proxy property change notificationsMarcel Holtmann2012-12-291-0/+23
|
* gdbus: Fix handling of client connect/disconnect signalsMarcel Holtmann2012-12-291-11/+12
|
* gdbus: Protect standalone proxy creation with client referenceMarcel Holtmann2012-12-291-10/+8
|
* gdbus: Use object manager only if callback functions are setMarcel Holtmann2012-12-271-8/+7
|
* gdbus: Use client service name and not hardcoded org.bluezMarcel Holtmann2012-12-271-1/+1
|
* gdbus: Add support for creating D-Bus proxies without object managerMarcel Holtmann2012-12-271-60/+143
|
* gdbus: Avoid using g_ptr_array_new_full convenience functionMarcel Holtmann2012-12-221-1/+2
| | | | | The g_ptr_array_new_full function only got introduced with GLib 2.30 and to avoid requiring a newer GLib use g_ptr_array_set_free_func instead.
* gdbus: Increase the method call timeout to 5 minutesMarcel Holtmann2012-12-181-1/+3
|
* gdbus: Fix race condition with creating duplicate client proxiesMarcel Holtmann2012-12-161-0/+23
|
* gdbus: Fix issue with unref of client while parsing interfacesMarcel Holtmann2012-12-161-0/+8
|
* gdbus: Fix issue with unref of client in connect handlerMarcel Holtmann2012-12-151-0/+8
|
* gdbus: Add support for D-Bus client method callsMarcel Holtmann2012-12-151-0/+74
|
* gdbus: Add callback support for handling property changesMarcel Holtmann2012-12-141-8/+25
|
* gdbus: Handle property changed signals and update propertyMarcel Holtmann2012-12-141-31/+107
|