Hi Jaganath, On Fri, May 4, 2012 at 12:57 PM, Jaganath Kanakkassery <jaganath.k@xxxxxxxxxxx> wrote: > If callback is provided in g_obex_cancel_transfer() current complete > callback will be replaced by the new one and user will be informed > when abort completes. > --- > gobex/gobex-transfer.c | 17 +++++++++++++++-- > gobex/gobex.c | 4 ++-- > gobex/gobex.h | 5 ++++- > 3 files changed, 21 insertions(+), 5 deletions(-) > > diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c > index c62a91e..724c788 100644 > --- a/gobex/gobex-transfer.c > +++ b/gobex/gobex-transfer.c > @@ -624,9 +624,11 @@ guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func, > user_data, err); > } > > -gboolean g_obex_cancel_transfer(guint id) > +gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func, > + gpointer user_data) > { > struct transfer *transfer = NULL; > + gboolean ret = TRUE; > > g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", id); > > @@ -635,6 +637,17 @@ gboolean g_obex_cancel_transfer(guint id) > if (transfer == NULL) > return FALSE; > > + if (complete_func == NULL) > + goto done; > + > + transfer->complete_func = complete_func; > + transfer->user_data = user_data; > + > + ret = g_obex_pending_req_abort(transfer->obex, NULL); > + if (ret) > + return TRUE; > + > +done: > transfer_free(transfer); > - return TRUE; > + return ret; > } > diff --git a/gobex/gobex.c b/gobex/gobex.c > index f31b733..b20542d 100644 > --- a/gobex/gobex.c > +++ b/gobex/gobex.c > @@ -684,7 +684,7 @@ static gint pending_pkt_cmp(gconstpointer a, gconstpointer b) > return (p->id - id); > } > > -static gboolean pending_req_abort(GObex *obex, GError **err) > +gboolean g_obex_pending_req_abort(GObex *obex, GError **err) > { > struct pending_pkt *p = obex->pending_req; > GObexPacket *req; > @@ -728,7 +728,7 @@ gboolean g_obex_cancel_req(GObex *obex, guint req_id, gboolean remove_callback) > struct pending_pkt *p; > > if (obex->pending_req && obex->pending_req->id == req_id) { > - if (!pending_req_abort(obex, NULL)) { > + if (!g_obex_pending_req_abort(obex, NULL)) { > p = obex->pending_req; > obex->pending_req = NULL; > goto immediate_completion; > diff --git a/gobex/gobex.h b/gobex/gobex.h > index aacdb53..3120da2 100644 > --- a/gobex/gobex.h > +++ b/gobex/gobex.h > @@ -49,6 +49,8 @@ guint g_obex_send_req(GObex *obex, GObexPacket *req, gint timeout, > gboolean g_obex_cancel_req(GObex *obex, guint req_id, > gboolean remove_callback); > > +gboolean g_obex_pending_req_abort(GObex *obex, GError **err); > + > gboolean g_obex_send_rsp(GObex *obex, guint8 rspcode, GError **err, > guint8 first_hdr_type, ...); > > @@ -122,7 +124,8 @@ guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp, > GObexDataProducer data_func, GObexFunc complete_func, > gpointer user_data, GError **err); > > -gboolean g_obex_cancel_transfer(guint id); > +gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func, > + gpointer user_data); > > const char *g_obex_strerror(guint8 err_code); > guint8 g_obex_errno_to_rsp(int err); > -- > 1.7.1 All 3 patches are now upstream, thanks. -- Luiz Augusto von Dentz -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html