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

gboolean gw_obex_xfer_flush ( GwObexXfer xfer,
gint *  error 
)

Force all data remaining in buffers to be sent

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 377 of file obex-xfer.c.

References GW_OBEX_ERROR_INVALID_PARAMS.

                                                         {
    gboolean ret = TRUE;
    struct gw_obex *ctx = xfer->ctx;

    if (!ctx) {
        if (err)
            *err = GW_OBEX_ERROR_INVALID_PARAMS;
      return FALSE;
    }

    GW_OBEX_LOCK(ctx);

    if (ctx->obex_op != OBEX_CMD_PUT)
        goto out;

    if (gw_obex_set_error(ctx)) {
        gw_obex_get_error(ctx, err);
        ret = FALSE;
        goto out;
    }

    while (xfer->data_length) {
        debug("OBEX_ResumeRequest at %s:%d (%s)\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
        OBEX_ResumeRequest(ctx->handle);

        if (gw_obex_set_error(ctx)) {
            gw_obex_get_error(ctx, err);
            ret = FALSE;
            goto out;
        }

        if (xfer->data_length) {
            if (!handle_input(ctx, err)) {
                ret = FALSE;
                goto out;
            }
        }
    }

out:
    GW_OBEX_UNLOCK(ctx);
    return ret;
}


Generated by  Doxygen 1.6.0   Back to index