made some fixes mainly for the bsd-sockets. It still

doesn't work on linux.
This commit is contained in:
Arvid Norberg 2003-10-24 02:18:11 +00:00
parent 1800e63c09
commit a09595c634
6 changed files with 15 additions and 6 deletions

View File

@ -68,7 +68,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/entry.hpp" #include "libtorrent/entry.hpp"
#ifdef _MSC_VER #if defined(_MSC_VER) && _MSC_VER < 1300
namespace std namespace std
{ {
using ::isdigit; using ::isdigit;
@ -226,7 +226,7 @@ namespace libtorrent
// ---------------------------------------------- // ----------------------------------------------
// string // string
default: default:
if (std::isdigit(*in)) if (isdigit(*in))
{ {
std::string len_s = read_until(in, end, ':'); std::string len_s = read_until(in, end, ':');
assert(*in == ':'); assert(*in == ':');

View File

@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector> #include <vector>
#include "libtorrent/peer.hpp" #include "libtorrent/peer.hpp"
#include "piece_picker.hpp" #include "libtorrent/piece_picker.hpp"
// TODO: should be able to close connections with too low bandwidth to save memory // TODO: should be able to close connections with too low bandwidth to save memory

View File

@ -162,7 +162,11 @@ namespace libtorrent
{ {
main_loop_thread(int listen_port, session_impl* s) main_loop_thread(int listen_port, session_impl* s)
: m_ses(s), m_listen_port(listen_port) {} : m_ses(s), m_listen_port(listen_port) {}
void operator()() { m_ses->run(m_listen_port); } void operator()()
{
std::cout << "main thread started\n";
m_ses->run(m_listen_port);
}
session_impl* m_ses; session_impl* m_ses;
int m_listen_port; int m_listen_port;
}; };

View File

@ -114,7 +114,10 @@ namespace libtorrent
entry::integer_type piece_size(unsigned int index) const entry::integer_type piece_size(unsigned int index) const
{ {
if (index == num_pieces()-1) if (index == num_pieces()-1)
return total_size() % m_piece_length; {
entry::integer_type s = total_size() % m_piece_length;
return (s == 0)?m_piece_length:s;
}
else else
return piece_length(); return piece_length();
} }

View File

@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <ctime> #include <ctime>
#include <iostream> #include <iostream>
#include <ios>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iterator> #include <iterator>

View File

@ -407,4 +407,5 @@ namespace libtorrent
} }
} }
} }