forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
410b35f95e
commit
b632d8bc20
|
@ -103,12 +103,13 @@ namespace libtorrent
|
|||
|
||||
struct peer
|
||||
{
|
||||
peer(const address& ip);
|
||||
enum connection_type { connectable, not_connectable };
|
||||
|
||||
peer(const address& ip, peer::connection_type t);
|
||||
|
||||
int total_download() const;
|
||||
int total_upload() const;
|
||||
|
||||
enum connection_type { local_connection, remote_connection };
|
||||
// the ip/port pair this peer is or was connected on
|
||||
// if it was a remote (incoming) connection, type is
|
||||
// set thereafter. If it was a peer we got from the
|
||||
|
|
|
@ -1609,8 +1609,7 @@ namespace libtorrent
|
|||
{
|
||||
if (m_socket->is_writable())
|
||||
{
|
||||
std::cout << "ERROR\n";
|
||||
assert(false);
|
||||
std::cout << "ERROR, not good\n";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -397,7 +397,7 @@ namespace libtorrent
|
|||
{
|
||||
if(i->connection) continue;
|
||||
if(i->banned) continue;
|
||||
if(i->type == peer::remote_connection) continue;
|
||||
if(!i->connectable) continue;
|
||||
|
||||
assert(i->connected <= local_time);
|
||||
|
||||
|
@ -565,7 +565,7 @@ namespace libtorrent
|
|||
// we don't have ny info about this peer.
|
||||
// add a new entry
|
||||
|
||||
peer p(c.get_socket()->sender());
|
||||
peer p(c.get_socket()->sender(), peer::not_connectable);
|
||||
m_peers.push_back(p);
|
||||
i = m_peers.end()-1;
|
||||
}
|
||||
|
@ -600,8 +600,7 @@ namespace libtorrent
|
|||
|
||||
// we don't have ny info about this peer.
|
||||
// add a new entry
|
||||
peer p(remote);
|
||||
p.type = peer::local_connection;
|
||||
peer p(remote, peer::connectable);
|
||||
m_peers.push_back(p);
|
||||
// the iterator is invalid
|
||||
// because of the push_back()
|
||||
|
@ -609,7 +608,7 @@ namespace libtorrent
|
|||
}
|
||||
else
|
||||
{
|
||||
i->type = peer::local_connection;
|
||||
i->type = peer::connectable;
|
||||
|
||||
// in case we got the ip from a remote connection, port is
|
||||
// not known, so save it. Client may also have changed port
|
||||
|
@ -739,7 +738,7 @@ namespace libtorrent
|
|||
if (p == 0) return false;
|
||||
assert(!p->banned);
|
||||
assert(!p->connection);
|
||||
assert(p->type != peer::remote_connection);
|
||||
assert(p->connectable);
|
||||
|
||||
p->connection = &m_torrent->connect_to_peer(p->id);
|
||||
p->connected = boost::posix_time::second_clock::local_time();
|
||||
|
@ -815,9 +814,9 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
policy::peer::peer(const address& pid)
|
||||
policy::peer::peer(const address& pid, peer::connection_type t)
|
||||
: id(pid)
|
||||
, type(remote_connection)
|
||||
, type(t)
|
||||
, last_optimistically_unchoked(
|
||||
boost::gregorian::date(1970,boost::gregorian::Jan,1))
|
||||
, connected(boost::gregorian::date(1970,boost::gregorian::Jan,1))
|
||||
|
|
|
@ -532,6 +532,7 @@ namespace libtorrent
|
|||
i != writable_clients.end();
|
||||
++i)
|
||||
{
|
||||
assert((*i)->is_writable());
|
||||
connection_map::iterator p = m_connections.find(*i);
|
||||
// the connection may have been disconnected in the receive phase
|
||||
if (p == m_connections.end())
|
||||
|
@ -544,6 +545,7 @@ namespace libtorrent
|
|||
{
|
||||
assert(m_selector.is_writability_monitored(p->first));
|
||||
assert(p->second->has_data());
|
||||
assert(p->second->get_socket()->is_writable());
|
||||
p->second->send_data();
|
||||
}
|
||||
catch(std::exception&)
|
||||
|
|
Loading…
Reference in New Issue