*** empty log message ***

This commit is contained in:
Arvid Norberg 2003-11-10 13:15:41 +00:00
parent 420ab6bff2
commit 3d385dde33
4 changed files with 29 additions and 7 deletions

View File

@ -169,7 +169,7 @@ int main(int argc, char* argv[])
{
std::vector<torrent_handle> handles;
session s(6881, "E\x1");
s.set_upload_rate_limit(10240);
// s.set_upload_rate_limit(20 * 1024);
s.set_http_settings(settings);
for (int i = 0; i < argc-1; ++i)
{

View File

@ -156,7 +156,7 @@ libtorrent::peer_connection::peer_connection(
libtorrent::peer_connection::~peer_connection()
{
m_receiving_piece.close();
m_selector.remove(m_socket);
if (m_torrent) m_torrent->remove_peer(this);
}
@ -942,7 +942,7 @@ void libtorrent::peer_connection::send_data()
// only add new piece-chunks if the send buffer is small enough
// otherwise there will be no end to how large it will be!
// TODO: make ths a bit better. Don't always read the entire
// TODO: make this a bit better. Don't always read the entire
// requested block. Have a limit of how much of the requested
// block is actually read at a time.
while (!m_requests.empty()

View File

@ -167,8 +167,10 @@ namespace libtorrent
eh_initializer();
#ifndef NDEBUG
m_logger = create_log("main session");
#endif
try
{
#endif
boost::shared_ptr<socket> listener(new socket(socket::tcp, false));
int max_port = m_listen_port + 9;
@ -282,7 +284,7 @@ namespace libtorrent
// TODO: add some possibility to filter IP:s
boost::shared_ptr<peer_connection> c(
new peer_connection(this, m_selector, s));
if (m_upload_rate != -1) c->set_send_quota(100);
if (m_upload_rate != -1) c->set_send_quota(0);
m_connections.insert(std::make_pair(s, c));
m_selector.monitor_readability(s);
m_selector.monitor_errors(s);
@ -437,9 +439,13 @@ namespace libtorrent
m_tracker_manager.queue_request(
i->second->generate_tracker_request(m_listen_port));
i->second->close_all_connections();
#ifndef NDEBUG
sha1_hash i_hash = i->second->torrent_file().info_hash();
#endif
std::map<sha1_hash, boost::shared_ptr<torrent> >::iterator j = i;
++i;
m_torrents.erase(j);
assert(m_torrents.find(i_hash) == m_torrents.end());
continue;
}
else if (i->second->should_request())
@ -474,6 +480,22 @@ namespace libtorrent
t.nsec += 1000000;
boost::thread::sleep(t);
}
#ifndef NDEBUG
}
catch(std::bad_cast& e)
{
std::cerr << e.what() << "\n";
}
catch(std::exception& e)
{
std::cerr << e.what() << "\n";
}
catch(...)
{
std::cerr << "error!\n";
}
#endif
}
@ -602,7 +624,7 @@ namespace libtorrent
void session::set_upload_rate_limit(int bytes_per_second)
{
assert(bytes_per_second > 0);
assert(bytes_per_second > 0 || bytes_per_second == -1);
boost::mutex::scoped_lock l(m_impl.m_mutex);
m_impl.m_upload_rate = bytes_per_second;
if (m_impl.m_upload_rate != -1 || !m_impl.m_connections.empty())

View File

@ -347,7 +347,7 @@ namespace libtorrent
, this
, s
, id));
if (m_ses->m_upload_rate != -1) c->set_send_quota(100);
if (m_ses->m_upload_rate != -1) c->set_send_quota(0);
detail::session_impl::connection_map::iterator p =
m_ses->m_connections.insert(std::make_pair(s, c)).first;
attach_peer(boost::get_pointer(p->second));