Logo Search packages:      
Sourcecode: obexd version File versions  Download package

gboolean gw_obex_xfer_abort ( GwObexXfer xfer,
gint *  error 
)

Abort an ongoing transfer

You still need to call gw_obex_xfer_free after this to free the actual memory allocated for the GwObexXfer object. xfer_close and xfer_abort are mutually exclusive (only call one of them for a transfer).

Parameters:
xfer Pointer returned by gw_obex_put_async or gw_obex_get_async
error Place to store error code on failure (NULL if not interested)
Returns:
TRUE on success, FALSE on failure

Definition at line 491 of file obex-xfer.c.

References GW_OBEX_ERROR_INTERNAL, and gw_obex_xfer_close().

                                                         {
    GwObex *ctx = xfer->ctx;
    gboolean ret = TRUE;

    /* If previous call failed just signal success so caller can continue */
    if (!ctx)
        return TRUE;

    GW_OBEX_LOCK(ctx);

    /* Return if abort has already been sent */
    if (xfer->abort)
        goto out;

    /* Return if actual request hasn't been sent */
    if (xfer->object) {
        OBEX_ObjectDelete(ctx->handle, xfer->object);
        xfer->object = NULL;
        ctx->done = TRUE;
        goto out;
    }

    if (!gw_obex_xfer_do_abort(xfer)) {
        ret = FALSE;
        if (err)
            *err = GW_OBEX_ERROR_INTERNAL;
        goto out;
    }

out:
    GW_OBEX_UNLOCK(ctx);

    gw_obex_xfer_close(xfer, err);

    return ret;
}


Generated by  Doxygen 1.6.0   Back to index