2006-04-25 23:04:48 +02:00
|
|
|
/*
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
Copyright (c) 2003 - 2006, Arvid Norberg
|
|
|
|
Copyright (c) 2007, Arvid Norberg, Un Shyam
|
2006-04-25 23:04:48 +02:00
|
|
|
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_BT_PEER_CONNECTION_HPP_INCLUDED
|
|
|
|
#define TORRENT_BT_PEER_CONNECTION_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include <ctime>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "libtorrent/debug.hpp"
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(push, 1)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <boost/smart_ptr.hpp>
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
#include <boost/array.hpp>
|
|
|
|
#include <boost/optional.hpp>
|
|
|
|
#include <boost/cstdint.hpp>
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(pop)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "libtorrent/buffer.hpp"
|
|
|
|
#include "libtorrent/peer_connection.hpp"
|
|
|
|
#include "libtorrent/socket.hpp"
|
|
|
|
#include "libtorrent/peer_id.hpp"
|
|
|
|
#include "libtorrent/stat.hpp"
|
|
|
|
#include "libtorrent/alert.hpp"
|
|
|
|
#include "libtorrent/torrent.hpp"
|
|
|
|
#include "libtorrent/peer_request.hpp"
|
|
|
|
#include "libtorrent/piece_block_progress.hpp"
|
|
|
|
#include "libtorrent/config.hpp"
|
2007-06-06 02:41:20 +02:00
|
|
|
#include "libtorrent/pe_crypto.hpp"
|
2006-04-25 23:04:48 +02:00
|
|
|
|
|
|
|
namespace libtorrent
|
|
|
|
{
|
|
|
|
class torrent;
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
{
|
|
|
|
struct session_impl;
|
|
|
|
}
|
|
|
|
|
|
|
|
class TORRENT_EXPORT bt_peer_connection
|
|
|
|
: public peer_connection
|
|
|
|
{
|
|
|
|
friend class invariant_access;
|
|
|
|
public:
|
|
|
|
|
|
|
|
// this is the constructor where the we are the active part.
|
|
|
|
// The peer_conenction should handshake and verify that the
|
|
|
|
// other end has the correct id
|
|
|
|
bt_peer_connection(
|
2006-10-11 16:02:21 +02:00
|
|
|
aux::session_impl& ses
|
2006-04-25 23:04:48 +02:00
|
|
|
, boost::weak_ptr<torrent> t
|
2007-04-23 23:36:21 +02:00
|
|
|
, boost::shared_ptr<socket_type> s
|
2007-04-10 23:23:13 +02:00
|
|
|
, tcp::endpoint const& remote
|
|
|
|
, policy::peer* peerinfo);
|
2006-04-25 23:04:48 +02:00
|
|
|
|
|
|
|
// with this constructor we have been contacted and we still don't
|
|
|
|
// know which torrent the connection belongs to
|
|
|
|
bt_peer_connection(
|
2006-10-11 16:02:21 +02:00
|
|
|
aux::session_impl& ses
|
2007-04-23 23:36:21 +02:00
|
|
|
, boost::shared_ptr<socket_type> s
|
2008-05-12 12:10:39 +02:00
|
|
|
, tcp::endpoint const& remote
|
2007-04-10 23:23:13 +02:00
|
|
|
, policy::peer* peerinfo);
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2008-03-31 06:46:24 +02:00
|
|
|
void start();
|
|
|
|
|
2010-09-05 18:01:36 +02:00
|
|
|
enum { upload_only_msg = 2, share_mode_msg = 3 };
|
2009-11-24 19:49:59 +01:00
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
~bt_peer_connection();
|
2007-06-06 02:41:20 +02:00
|
|
|
|
|
|
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
bool supports_encryption() const
|
|
|
|
{ return m_encrypted; }
|
|
|
|
#endif
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2009-11-02 21:43:38 +01:00
|
|
|
virtual int type() const { return peer_connection::bittorrent_connection; }
|
|
|
|
|
2006-11-14 01:08:16 +01:00
|
|
|
enum message_type
|
|
|
|
{
|
|
|
|
// standard messages
|
|
|
|
msg_choke = 0,
|
|
|
|
msg_unchoke,
|
|
|
|
msg_interested,
|
|
|
|
msg_not_interested,
|
|
|
|
msg_have,
|
|
|
|
msg_bitfield,
|
|
|
|
msg_request,
|
|
|
|
msg_piece,
|
|
|
|
msg_cancel,
|
2007-08-14 19:47:48 +02:00
|
|
|
// DHT extension
|
2006-11-14 01:08:16 +01:00
|
|
|
msg_dht_port,
|
2007-08-14 19:47:48 +02:00
|
|
|
// FAST extension
|
|
|
|
msg_suggest_piece = 0xd,
|
|
|
|
msg_have_all,
|
|
|
|
msg_have_none,
|
|
|
|
msg_reject_request,
|
|
|
|
msg_allowed_fast,
|
2009-03-13 07:09:39 +01:00
|
|
|
|
2007-08-14 19:47:48 +02:00
|
|
|
// extension protocol message
|
2006-11-14 01:08:16 +01:00
|
|
|
msg_extended = 20,
|
|
|
|
|
|
|
|
num_supported_messages
|
|
|
|
};
|
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
// called from the main loop when this connection has any
|
|
|
|
// work to do.
|
|
|
|
|
2008-05-03 18:05:42 +02:00
|
|
|
void on_sent(error_code const& error
|
2006-04-25 23:04:48 +02:00
|
|
|
, std::size_t bytes_transferred);
|
2008-05-03 18:05:42 +02:00
|
|
|
void on_receive(error_code const& error
|
2006-04-25 23:04:48 +02:00
|
|
|
, std::size_t bytes_transferred);
|
|
|
|
|
2007-05-25 21:42:10 +02:00
|
|
|
virtual void get_specific_peer_info(peer_info& p) const;
|
2007-01-29 08:39:33 +01:00
|
|
|
virtual bool in_handshake() const;
|
|
|
|
|
2006-11-14 01:08:16 +01:00
|
|
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
2006-04-25 23:04:48 +02:00
|
|
|
bool support_extensions() const { return m_supports_extensions; }
|
2006-11-14 01:08:16 +01:00
|
|
|
#endif
|
2006-04-25 23:04:48 +02:00
|
|
|
|
|
|
|
// the message handlers are called
|
|
|
|
// each time a recv() returns some new
|
|
|
|
// data, the last time it will be called
|
|
|
|
// is when the entire packet has been
|
|
|
|
// received, then it will no longer
|
|
|
|
// be called. i.e. most handlers need
|
|
|
|
// to check how much of the packet they
|
|
|
|
// have received before any processing
|
|
|
|
void on_keepalive();
|
|
|
|
void on_choke(int received);
|
|
|
|
void on_unchoke(int received);
|
|
|
|
void on_interested(int received);
|
|
|
|
void on_not_interested(int received);
|
|
|
|
void on_have(int received);
|
|
|
|
void on_bitfield(int received);
|
|
|
|
void on_request(int received);
|
|
|
|
void on_piece(int received);
|
|
|
|
void on_cancel(int received);
|
2007-08-14 19:47:48 +02:00
|
|
|
|
|
|
|
// DHT extension
|
2006-04-25 23:04:48 +02:00
|
|
|
void on_dht_port(int received);
|
|
|
|
|
2007-08-14 19:47:48 +02:00
|
|
|
// FAST extension
|
|
|
|
void on_suggest_piece(int received);
|
|
|
|
void on_have_all(int received);
|
|
|
|
void on_have_none(int received);
|
|
|
|
void on_reject_request(int received);
|
|
|
|
void on_allowed_fast(int received);
|
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
void on_extended(int received);
|
|
|
|
|
|
|
|
void on_extended_handshake();
|
|
|
|
|
|
|
|
typedef void (bt_peer_connection::*message_handler)(int received);
|
|
|
|
|
|
|
|
// the following functions appends messages
|
|
|
|
// to the send buffer
|
|
|
|
void write_choke();
|
|
|
|
void write_unchoke();
|
|
|
|
void write_interested();
|
|
|
|
void write_not_interested();
|
|
|
|
void write_request(peer_request const& r);
|
|
|
|
void write_cancel(peer_request const& r);
|
2008-06-07 04:58:28 +02:00
|
|
|
void write_bitfield();
|
2006-04-25 23:04:48 +02:00
|
|
|
void write_have(int index);
|
2008-04-10 12:03:23 +02:00
|
|
|
void write_piece(peer_request const& r, disk_buffer_holder& buffer);
|
2006-04-25 23:04:48 +02:00
|
|
|
void write_handshake();
|
2006-11-14 01:08:16 +01:00
|
|
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
2006-04-25 23:04:48 +02:00
|
|
|
void write_extensions();
|
2009-11-24 19:49:59 +01:00
|
|
|
void write_upload_only();
|
2010-09-05 18:01:36 +02:00
|
|
|
void write_share_mode();
|
2006-11-14 01:08:16 +01:00
|
|
|
#endif
|
2006-04-25 23:04:48 +02:00
|
|
|
void write_metadata(std::pair<int, int> req);
|
|
|
|
void write_metadata_request(std::pair<int, int> req);
|
|
|
|
void write_keepalive();
|
2007-08-14 19:47:48 +02:00
|
|
|
|
|
|
|
// DHT extension
|
2006-04-25 23:04:48 +02:00
|
|
|
void write_dht_port(int listen_port);
|
2007-08-14 19:47:48 +02:00
|
|
|
|
|
|
|
// FAST extension
|
|
|
|
void write_have_all();
|
|
|
|
void write_have_none();
|
|
|
|
void write_reject_request(peer_request const&);
|
|
|
|
void write_allow_fast(int piece);
|
2010-01-15 17:45:42 +01:00
|
|
|
void write_suggest(int piece);
|
2007-08-14 19:47:48 +02:00
|
|
|
|
2007-07-09 06:22:38 +02:00
|
|
|
void on_connected();
|
2006-11-14 01:08:16 +01:00
|
|
|
void on_metadata();
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2008-11-29 22:33:21 +01:00
|
|
|
#ifdef TORRENT_DEBUG
|
2006-04-25 23:04:48 +02:00
|
|
|
void check_invariant() const;
|
2007-04-05 00:27:36 +02:00
|
|
|
ptime m_last_choke;
|
2006-04-25 23:04:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
bool dispatch_message(int received);
|
|
|
|
// returns the block currently being
|
|
|
|
// downloaded. And the progress of that
|
|
|
|
// block. If the peer isn't downloading
|
|
|
|
// a piece for the moment, the boost::optional
|
|
|
|
// will be invalid.
|
|
|
|
boost::optional<piece_block_progress> downloading_piece_progress() const;
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
|
|
|
|
// if (is_local()), we are 'a' otherwise 'b'
|
|
|
|
//
|
|
|
|
// 1. a -> b dhkey, pad
|
|
|
|
// 2. b -> a dhkey, pad
|
|
|
|
// 3. a -> b sync, payload
|
|
|
|
// 4. b -> a sync, payload
|
|
|
|
// 5. a -> b payload
|
|
|
|
|
|
|
|
void write_pe1_2_dhkey();
|
|
|
|
void write_pe3_sync();
|
|
|
|
void write_pe4_sync(int crypto_select);
|
|
|
|
|
2009-01-28 05:20:05 +01:00
|
|
|
void write_pe_vc_cryptofield(buffer::interval& write_buf
|
|
|
|
, int crypto_field, int pad_size);
|
2007-06-06 02:41:20 +02:00
|
|
|
|
|
|
|
// stream key (info hash of attached torrent)
|
|
|
|
// secret is the DH shared secret
|
|
|
|
// initializes m_RC4_handler
|
|
|
|
void init_pe_RC4_handler(char const* secret, sha1_hash const& stream_key);
|
|
|
|
|
2007-12-02 05:16:51 +01:00
|
|
|
public:
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
// these functions encrypt the send buffer if m_rc4_encrypted
|
|
|
|
// is true, otherwise it passes the call to the
|
|
|
|
// peer_connection functions of the same names
|
2010-06-18 07:44:08 +02:00
|
|
|
virtual void append_const_send_buffer(char const* buffer, int size);
|
2009-01-27 07:57:55 +01:00
|
|
|
void send_buffer(char const* buf, int size, int flags = 0);
|
2007-06-06 02:41:20 +02:00
|
|
|
buffer::interval allocate_send_buffer(int size);
|
2007-09-29 18:14:03 +02:00
|
|
|
template <class Destructor>
|
|
|
|
void append_send_buffer(char* buffer, int size, Destructor const& destructor)
|
|
|
|
{
|
|
|
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
if (m_rc4_encrypted)
|
2009-01-28 05:20:05 +01:00
|
|
|
{
|
|
|
|
TORRENT_ASSERT(send_buffer_size() == m_encrypted_bytes);
|
2007-09-29 18:14:03 +02:00
|
|
|
m_RC4_handler->encrypt(buffer, size);
|
2009-01-28 05:20:05 +01:00
|
|
|
#ifdef TORRENT_DEBUG
|
|
|
|
m_encrypted_bytes += size;
|
2009-02-04 06:51:00 +01:00
|
|
|
TORRENT_ASSERT(m_encrypted_bytes == send_buffer_size() + size);
|
2009-01-28 05:20:05 +01:00
|
|
|
#endif
|
|
|
|
}
|
2007-09-29 18:14:03 +02:00
|
|
|
#endif
|
|
|
|
peer_connection::append_send_buffer(buffer, size, destructor);
|
|
|
|
}
|
2007-06-06 02:41:20 +02:00
|
|
|
void setup_send();
|
|
|
|
|
2007-12-02 05:16:51 +01:00
|
|
|
private:
|
|
|
|
|
2009-01-28 05:20:05 +01:00
|
|
|
void encrypt_pending_buffer();
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
// Returns offset at which bytestream (src, src + src_size)
|
|
|
|
// matches bytestream(target, target + target_size).
|
|
|
|
// If no sync found, return -1
|
2009-01-28 05:20:05 +01:00
|
|
|
int get_syncoffset(char const* src, int src_size
|
|
|
|
, char const* target, int target_size) const;
|
2007-06-06 02:41:20 +02:00
|
|
|
#endif
|
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
enum state
|
|
|
|
{
|
2007-06-06 02:41:20 +02:00
|
|
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
read_pe_dhkey = 0,
|
|
|
|
read_pe_syncvc,
|
|
|
|
read_pe_synchash,
|
|
|
|
read_pe_skey_vc,
|
|
|
|
read_pe_cryptofield,
|
|
|
|
read_pe_pad,
|
|
|
|
read_pe_ia,
|
|
|
|
init_bt_handshake,
|
|
|
|
read_protocol_identifier,
|
|
|
|
#else
|
|
|
|
read_protocol_identifier = 0,
|
|
|
|
#endif
|
2006-04-25 23:04:48 +02:00
|
|
|
read_info_hash,
|
|
|
|
read_peer_id,
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
// handshake complete
|
2006-04-25 23:04:48 +02:00
|
|
|
read_packet_size,
|
|
|
|
read_packet
|
|
|
|
};
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
handshake_len = 68,
|
|
|
|
dh_key_len = 96
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
std::string m_client_version;
|
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
// state of on_receive
|
2006-04-25 23:04:48 +02:00
|
|
|
state m_state;
|
|
|
|
|
|
|
|
static const message_handler m_message_handler[num_supported_messages];
|
|
|
|
|
|
|
|
// this is a queue of ranges that describes
|
|
|
|
// where in the send buffer actual payload
|
|
|
|
// data is located. This is currently
|
|
|
|
// only used to be able to gather statistics
|
|
|
|
// seperately on payload and protocol data.
|
|
|
|
struct range
|
|
|
|
{
|
|
|
|
range(int s, int l)
|
|
|
|
: start(s)
|
|
|
|
, length(l)
|
|
|
|
{
|
2007-10-05 02:30:00 +02:00
|
|
|
TORRENT_ASSERT(s >= 0);
|
|
|
|
TORRENT_ASSERT(l > 0);
|
2006-04-25 23:04:48 +02:00
|
|
|
}
|
|
|
|
int start;
|
|
|
|
int length;
|
|
|
|
};
|
|
|
|
static bool range_below_zero(const range& r)
|
|
|
|
{ return r.start < 0; }
|
2009-05-03 22:21:24 +02:00
|
|
|
std::vector<range> m_payloads;
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2010-01-15 17:45:42 +01:00
|
|
|
// we have suggested these pieces to the peer
|
|
|
|
// don't suggest it again
|
|
|
|
bitfield m_sent_suggested_pieces;
|
|
|
|
|
2006-11-14 01:08:16 +01:00
|
|
|
#ifndef TORRENT_DISABLE_EXTENSIONS
|
2009-11-24 19:49:59 +01:00
|
|
|
// the message ID for upload only message
|
|
|
|
// 0 if not supported
|
|
|
|
int m_upload_only_id;
|
|
|
|
|
2010-09-05 18:01:36 +02:00
|
|
|
// the message ID for share mode message
|
|
|
|
// 0 if not supported
|
|
|
|
int m_share_mode_id;
|
|
|
|
|
2009-11-24 19:49:59 +01:00
|
|
|
char m_reserved_bits[8];
|
2006-04-25 23:04:48 +02:00
|
|
|
// this is set to true if the handshake from
|
|
|
|
// the peer indicated that it supports the
|
|
|
|
// extension protocol
|
2009-11-24 19:49:59 +01:00
|
|
|
bool m_supports_extensions:1;
|
2006-11-14 01:08:16 +01:00
|
|
|
#endif
|
2009-11-24 19:49:59 +01:00
|
|
|
bool m_supports_dht_port:1;
|
|
|
|
bool m_supports_fast:1;
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
#ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
// this is set to true after the encryption method has been
|
|
|
|
// succesfully negotiated (either plaintext or rc4), to signal
|
|
|
|
// automatic encryption/decryption.
|
|
|
|
bool m_encrypted;
|
|
|
|
|
|
|
|
// true if rc4, false if plaintext
|
|
|
|
bool m_rc4_encrypted;
|
|
|
|
|
|
|
|
// used to disconnect peer if sync points are not found within
|
|
|
|
// the maximum number of bytes
|
|
|
|
int m_sync_bytes_read;
|
|
|
|
|
|
|
|
// hold information about latest allocated send buffer
|
2007-10-04 23:26:50 +02:00
|
|
|
// need to check for non zero (begin, end) for operations with this
|
2007-06-06 02:41:20 +02:00
|
|
|
buffer::interval m_enc_send_buffer;
|
|
|
|
|
|
|
|
// initialized during write_pe1_2_dhkey, and destroyed on
|
|
|
|
// creation of m_RC4_handler. Cannot reinitialize once
|
|
|
|
// initialized.
|
2008-06-28 19:58:15 +02:00
|
|
|
boost::scoped_ptr<dh_key_exchange> m_dh_key_exchange;
|
2007-06-06 02:41:20 +02:00
|
|
|
|
|
|
|
// if RC4 is negotiated, this is used for
|
|
|
|
// encryption/decryption during the entire session. Destroyed
|
|
|
|
// if plaintext is selected
|
|
|
|
boost::scoped_ptr<RC4_handler> m_RC4_handler;
|
|
|
|
|
|
|
|
// (outgoing only) synchronize verification constant with
|
|
|
|
// remote peer, this will hold RC4_decrypt(vc). Destroyed
|
|
|
|
// after the sync step.
|
|
|
|
boost::scoped_array<char> m_sync_vc;
|
|
|
|
|
|
|
|
// (incoming only) synchronize hash with remote peer, holds
|
|
|
|
// the sync hash (hash("req1",secret)). Destroyed after the
|
|
|
|
// sync step.
|
|
|
|
boost::scoped_ptr<sha1_hash> m_sync_hash;
|
|
|
|
#endif // #ifndef TORRENT_DISABLE_ENCRYPTION
|
|
|
|
|
2008-11-29 22:33:21 +01:00
|
|
|
#ifdef TORRENT_DEBUG
|
2006-11-14 01:08:16 +01:00
|
|
|
// this is set to true when the client's
|
|
|
|
// bitfield is sent to this peer
|
|
|
|
bool m_sent_bitfield;
|
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
bool m_in_constructor;
|
2007-07-09 06:22:38 +02:00
|
|
|
|
|
|
|
bool m_sent_handshake;
|
2009-01-28 05:20:05 +01:00
|
|
|
|
|
|
|
// the number of bytes in the send buffer
|
|
|
|
// that have been encrypted (only used for
|
|
|
|
// encrypted connections)
|
2009-02-03 08:46:24 +01:00
|
|
|
public:
|
2009-01-28 05:20:05 +01:00
|
|
|
int m_encrypted_bytes;
|
2006-04-25 23:04:48 +02:00
|
|
|
#endif
|
2007-06-06 02:41:20 +02:00
|
|
|
|
2006-04-25 23:04:48 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TORRENT_BT_PEER_CONNECTION_HPP_INCLUDED
|
|
|
|
|