add new lt files

This commit is contained in:
Marcos Pinto 2007-06-15 22:30:39 +00:00
parent 72261756f5
commit 261be67769
8 changed files with 443 additions and 1 deletions

View File

@ -0,0 +1,70 @@
//
// unicast.hpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_IP_UNICAST_HPP
#define ASIO_IP_UNICAST_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/push_options.hpp"
#include "asio/detail/push_options.hpp"
#include <cstddef>
#include <boost/config.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/ip/detail/socket_option.hpp"
namespace asio {
namespace ip {
namespace unicast {
/// Socket option for time-to-live associated with outgoing unicast packets.
/**
* Implements the IPPROTO_IP/IP_UNICAST_TTL socket option.
*
* @par Examples
* Setting the option:
* @code
* asio::ip::udp::socket socket(io_service);
* ...
* asio::ip::unicast::hops option(4);
* socket.set_option(option);
* @endcode
*
* @par
* Getting the current option value:
* @code
* asio::ip::udp::socket socket(io_service);
* ...
* asio::ip::unicast::hops option;
* socket.get_option(option);
* int ttl = option.value();
* @endcode
*
* @par Concepts:
* GettableSocketOption, SettableSocketOption.
*/
#if defined(GENERATING_DOCUMENTATION)
typedef implementation_defined hops;
#else
typedef asio::ip::detail::socket_option::unicast_hops<
IPPROTO_IP, IP_TTL, IPPROTO_IPV6, IPV6_UNICAST_HOPS> hops;
#endif
} // namespace unicast
} // namespace ip
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // ASIO_IP_UNICAST_HPP

View File

@ -0,0 +1,68 @@
//
// v6_only.hpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_IP_V6_ONLY_HPP
#define ASIO_IP_V6_ONLY_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/push_options.hpp"
#include "asio/detail/socket_option.hpp"
namespace asio {
namespace ip {
/// Socket option for determining whether an IPv6 socket supports IPv6
/// communication only.
/**
* Implements the IPPROTO_IPV6/IP_V6ONLY socket option.
*
* @par Examples
* Setting the option:
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::ip::v6_only option(true);
* socket.set_option(option);
* @endcode
*
* @par
* Getting the current option value:
* @code
* asio::ip::tcp::socket socket(io_service);
* ...
* asio::ip::v6_only option;
* socket.get_option(option);
* bool v6_only = option.value();
* @endcode
*
* @par Concepts:
* GettableSocketOption, SettableSocketOption.
*/
#if defined(GENERATING_DOCUMENTATION)
typedef implementation_defined v6_only;
#elif defined(IPV6_V6ONLY)
typedef asio::detail::socket_option::boolean<
IPPROTO_IPV6, IPV6_V6ONLY> v6_only;
#else
typedef asio::detail::socket_option::boolean<
asio::detail::custom_socket_option_level,
asio::detail::always_fail_option> v6_only;
#endif
} // namespace ip
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // ASIO_IP_V6_ONLY_HPP

View File

@ -0,0 +1,23 @@
//
// version.hpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_VERSION_HPP
#define ASIO_VERSION_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
// ASIO_VERSION % 100 is the sub-minor version
// ASIO_VERSION / 100 % 1000 is the minor version
// ASIO_VERSION / 100000 is the major version
#define ASIO_VERSION 308 // 0.3.8
#endif // ASIO_VERSION_HPP

View File

@ -0,0 +1,119 @@
/*
Copyright (c) 2007, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/storage.hpp"
#include <boost/thread/thread.hpp>
#include <boost/function.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/bind.hpp>
#include <boost/pool/pool.hpp>
#include <boost/noncopyable.hpp>
#include "libtorrent/config.hpp"
namespace libtorrent
{
struct disk_io_job
{
disk_io_job()
: action(read)
, buffer(0)
, buffer_size(0)
, piece(0)
, offset(0)
{}
enum action_t
{
read
, write
, hash
, move_storage
, release_files
};
action_t action;
char* buffer;
size_type buffer_size;
boost::intrusive_ptr<piece_manager> storage;
// arguments used for read and write
int piece, offset;
// used for move_storage. On errors, this is set
// to the error message
std::string str;
// this is called when operation completes
boost::function<void(int, disk_io_job const&)> callback;
};
// this is a singleton consisting of the thread and a queue
// of disk io jobs
struct disk_io_thread : boost::noncopyable
{
disk_io_thread(int block_size = 16 * 1024);
~disk_io_thread();
// aborts read operations
void stop(boost::intrusive_ptr<piece_manager> s);
void add_job(disk_io_job const& j
, boost::function<void(int, disk_io_job const&)> const& f
= boost::function<void(int, disk_io_job const&)>());
// keep track of the number of bytes in the job queue
// at any given time. i.e. the sum of all buffer_size.
// this is used to slow down the download global download
// speed when the queue buffer size is too big.
size_type queue_buffer_size() const
{ return m_queue_buffer_size; }
void operator()();
char* allocate_buffer();
private:
boost::mutex m_mutex;
boost::condition m_signal;
bool m_abort;
std::deque<disk_io_job> m_jobs;
size_type m_queue_buffer_size;
// memory pool for read and write operations
boost::pool<> m_pool;
// thread for performing blocking disk io operations
boost::thread m_disk_io_thread;
};
}

View File

@ -0,0 +1,71 @@
/*
Copyright (c) 2007, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TORRENT_INTRUSIVE_PTR_BASE
#define TORRENT_INTRUSIVE_PTR_BASE
#include <boost/detail/atomic_count.hpp>
#include <cassert>
#include "libtorrent/config.hpp"
namespace libtorrent
{
template<class T>
struct intrusive_ptr_base
{
friend void intrusive_ptr_add_ref(intrusive_ptr_base<T> const* s)
{
assert(s->m_refs >= 0);
assert(s != 0);
++s->m_refs;
}
friend void intrusive_ptr_release(intrusive_ptr_base<T> const* s)
{
assert(s->m_refs > 0);
assert(s != 0);
if (--s->m_refs == 0)
delete static_cast<T const*>(s);
}
int refcount() const { return m_refs; }
intrusive_ptr_base(): m_refs(0) {}
private:
// reference counter for intrusive_ptr
mutable boost::detail::atomic_count m_refs;
};
}
#endif

View File

@ -0,0 +1,91 @@
/*
Copyright (c) 2007, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TORRENT_SOCKS4_STREAM_HPP_INCLUDED
#define TORRENT_SOCKS4_STREAM_HPP_INCLUDED
#include "libtorrent/proxy_base.hpp"
namespace libtorrent {
class socks4_stream : public proxy_base
{
public:
explicit socks4_stream(asio::io_service& io_service)
: proxy_base(io_service)
{}
void set_username(std::string const& user)
{
m_user = user;
}
typedef boost::function<void(asio::error_code const&)> handler_type;
template <class Handler>
void async_connect(endpoint_type const& endpoint, Handler const& handler)
{
m_remote_endpoint = endpoint;
// the connect is split up in the following steps:
// 1. resolve name of proxy server
// 2. connect to proxy server
// 3. send SOCKS4 CONNECT message
// to avoid unnecessary copying of the handler,
// store it in a shaed_ptr
boost::shared_ptr<handler_type> h(new handler_type(handler));
tcp::resolver::query q(m_hostname
, boost::lexical_cast<std::string>(m_port));
m_resolver.async_resolve(q, boost::bind(
&socks4_stream::name_lookup, this, _1, _2, h));
}
private:
void name_lookup(asio::error_code const& e, tcp::resolver::iterator i
, boost::shared_ptr<handler_type> h);
void connected(asio::error_code const& e, boost::shared_ptr<handler_type> h);
void handshake1(asio::error_code const& e, boost::shared_ptr<handler_type> h);
void handshake2(asio::error_code const& e, boost::shared_ptr<handler_type> h);
// send and receive buffer
std::vector<char> m_buffer;
// proxy authentication
std::string m_user;
};
}
#endif

View File

@ -446,6 +446,7 @@ class Manager:
# altering max_active_torrents), or just from time to time
# ___ALL queuing code should be in this function, and ONLY here___
def apply_queue(self, efficient = True):
print ("applying queue")
# Handle autoseeding - downqueue as needed
if self.get_pref('auto_seed_ratio') > 0:
for unique_ID in self.unique_IDs:

View File

@ -640,7 +640,6 @@ class DelugeGTK:
def update(self):
# We need to apply the queue changes
self.manager.apply_queue()
# Make sure that the interface still exists
try:
tab = self.wtree.get_widget("torrent_info").get_current_page()