示例#1
0
int GridFTPModule::close(gfal_file_handle handle)
{
    GridFTPFileDesc* desc = static_cast<GridFTPFileDesc*>(gfal_file_handle_get_fdesc(handle));
    if (desc) {
        gridftp_rw_commit_put(GFAL_GRIDFTP_SCOPE_CLOSE, desc);

        if (is_write_only(desc->open_flags)) {
            desc->request->wait(GFAL_GRIDFTP_SCOPE_CLOSE);
        }
        else if (is_read_only(desc->open_flags)) {
            if (!desc->request->done)
                globus_ftp_client_abort(desc->handler->get_ftp_client_handle());
            try {
                desc->request->wait(GFAL_GRIDFTP_SCOPE_CLOSE);
            }
            catch (const Gfal::CoreException& e) {
                if (e.code() != ECANCELED)
                    throw;
            }
        }

        gfal_file_handle_delete(handle);
        delete desc;
    }
    return 0;
}
示例#2
0
void gw_tm_ftp_transfer_destroy (gw_tm_ftp_transfer_t *xfr)
{    
	int *xfr_id;
	globus_result_t rc;
	
	xfr_id  = ( int *) malloc (sizeof(int));
	*xfr_id = xfr->jid;
	
	globus_ftp_client_abort (&(xfr->handle));
	
	rc = globus_gass_copy_cancel( &(xfr->gass_handle), gw_tm_ftp_transfer_cancel_cb,
        (void *)  xfr_id);
    
    if ( rc != GLOBUS_SUCCESS ) /* No transfer in progress */
		gw_tm_ftp_transfer_cancel_cb((void *)  xfr_id, NULL, NULL);
	    
}