コード例 #1
0
ファイル: transfer.c プロジェクト: GNOME/gftp
gint
update_downloads (gpointer data)
{
  intptr_t do_one_transfer_at_a_time, start_transfers;
  GList * templist, * next;
  gftp_transfer * tdata;

  if (gftp_file_transfer_logs != NULL)
    display_cached_logs ();

  if (window1.request->gotbytes != 0)
    update_window_transfer_bytes (&window1);
  if (window2.request->gotbytes != 0)
    update_window_transfer_bytes (&window2);

  if (gftpui_common_child_process_done)
    check_done_process ();

  for (templist = gftp_file_transfers; templist != NULL;)
    {
      tdata = templist->data;
      if (tdata->ready)
        {
          g_static_mutex_lock (&tdata->structmutex);

	  if (tdata->next_file)
	    on_next_transfer (tdata);
     	  else if (tdata->show) 
	    show_transfer (tdata);
	  else if (tdata->done)
	    {
	      next = templist->next;
              g_static_mutex_unlock (&tdata->structmutex);
	      transfer_done (templist);
	      templist = next;
	      continue;
	    }

	  if (tdata->curfle != NULL)
	    {
              gftp_lookup_global_option ("one_transfer", 
                                         &do_one_transfer_at_a_time);
              gftp_lookup_global_option ("start_transfers", &start_transfers);

	      if (!tdata->started && start_transfers &&
                 (num_transfers_in_progress == 0 || !do_one_transfer_at_a_time))
                create_transfer (tdata);

	      if (tdata->started)
                update_file_status (tdata);
	    }
          g_static_mutex_unlock (&tdata->structmutex);
        }
      templist = templist->next;
    }

  gtk_timeout_add (500, update_downloads, NULL);
  return (0);
}
コード例 #2
0
ファイル: session_filesystem.cpp プロジェクト: 7orlum/qmule
void FileNode::share(bool recursive, bool share_files/* = true*/)
{
    Q_UNUSED(recursive);
    if (m_active) return;
    m_active = true;

    if (has_metadata())
    {
        create_transfer();
    }
    else
    {
        QString fp = filepath();
        Session::instance()->addToProgress(fp, this);
        Session::instance()->get_ed2k_session()->makeTransferParametersAsync(filepath());
    }

    Session::instance()->signal_changeNode(this);
}
コード例 #3
0
ファイル: transfer.c プロジェクト: GNOME/gftp
void
start_transfer (gpointer data)
{
  gftpui_common_curtrans_data * transdata;
  GtkCTreeNode * node;

  if (GTK_CLIST (dlwdw)->selection == NULL)
    {
      ftp_log (gftp_logging_error, NULL,
	       _("There are no file transfers selected\n"));
      return;
    }
  node = GTK_CLIST (dlwdw)->selection->data;
  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);

  g_static_mutex_lock (&transdata->transfer->structmutex);
  if (!transdata->transfer->started)
    create_transfer (transdata->transfer);
  g_static_mutex_unlock (&transdata->transfer->structmutex);
}
コード例 #4
0
ファイル: session_filesystem.cpp プロジェクト: 7orlum/qmule
bool FileNode::on_metadata_completed(const libed2k::add_transfer_params& atp, const libed2k::error_code& ec)
{            
    m_error = ec;

    if (!ec)
    {
        // parameters ready
        if (!m_atp) m_atp = new libed2k::add_transfer_params;

        *m_atp = atp;

        if (is_active())
        {
            create_transfer();
        }
    }
    else
    {        
        // parameters possibly were cancelled or completed with errors
        delete m_atp;
        m_atp = NULL;
        m_active = false;

        if (has_transfer())
        {
            QString hash = m_hash;
            Session::instance()->deleteTransfer(hash, false);
        }
    }

    // ignore cancel - it is not error
    if (ec == libed2k::errors::make_error_code(libed2k::errors::file_params_making_was_cancelled))
        m_error = libed2k::errors::no_error;

    Session::instance()->signal_changeNode(this);
    return (!m_error);
}