Parent: c852bd299728037ac0c501a0ee0303d318678f21
Author: Dmitriy Paliy <dmitriy.paliy@nokia.com>
Committer: Marcel Holtmann <marcel@holtmann.org>
Date: 2012-12-04 23:48:32
Tree: ae8cdb26c91490a41a39d9bbb4fbfa5eedf0039a
obexd: Add handing of backend pending request Add phonebook_req_finalize function prototype in phonebook.h that deallocates resources associated to asynchronous request, and cancels the request if it is not completed. It unrefs pointer to pending request if such is applicable. It does the following, depending on phonebook backend: - for phonebook-tracker.c backend driver, it cancels pending DBus call, - for phonebook-dummy.c, it removes GSource with a given id, - for phonebook-ebook.c, it cancels last, still running, asynchronous operation. The following modifcations are donein the code. Phonebook request pointer is added in PBAP object and IRMC session data to provide reference for pending call. Phonebook callbacks are updated in PBAP and IRMC to unref request upon completion and clear pointers, if such is applicable. PBAP and IRMC are updated to cancel pending request, if any, when OBEX object is closed. Phonebook_pull, phonebook_get_entry, phonebook_create_cache functions are updated to return void pointer to backend specific request and error code. All backend drivers updated accordingly to the modified API, which are phonebook-tracker.c, phonebook-dummy.c, and phonebook-ebook.c, to be specific. In phonebook-tracker.c, query_tracker is updated to return pending DBus call request. Allocated pending_reply and phonebook_data are destroyed after call is unrefed. For this purpose new query_free_data function is created. Call is unrefed either if request succeeded or in phonebook_req_finalize if terminated. Such fix prevents obexd crash on unexpected OBEX session close. E.g., OBEX session is closed before reply comes from phonebook backend. In that case, both session and object are destroyed, and dereferencing of object in associated callback function causes crash.
Diffstat
| M | obexd/plugins/irmc.c | | | 27 | ++++++++++++++++++++- - - - - - - |
| M | obexd/plugins/pbap.c | | | 65 | ++++++++++++++++++++++++++++++++++++++++- - - - - - - - - - - - - - - - |
| M | obexd/plugins/phonebook-dummy.c | | | 70 | ++++++++++++++++++++++++++++++++++++++++- - - - - - - - - - - - - - - - - - - - - |
| M | obexd/plugins/phonebook-ebook.c | | | 96 | ++++++++++++++++++++++++++++++++++++++++- - - - - - - - - - - - - - - - - - |
| M | obexd/plugins/phonebook-tracker.c | | | 113 | ++++++++++++++++++++++++++++++++++++++++- - - - - - - - - - - - - - - - - - - - - - - - - - - |
| M | obexd/plugins/phonebook.h | | | 35 | ++++++++++++++++++++++++++++- - - - - - - |
6 files changed, 310 insertions(+), 96 deletions(-)