*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-03-24 22:50:07 +00:00
parent 870b4aeaab
commit a005dfa489
4 changed files with 26 additions and 6 deletions

View File

@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <cassert> #include <cassert>
#include <algorithm>
namespace libtorrent namespace libtorrent
{ {

View File

@ -185,7 +185,7 @@ namespace libtorrent
private: private:
socket(int sock, const address& sender); socket(int sock, const address& sender, bool blocking);
int m_socket; int m_socket;
address m_sender; address m_sender;

View File

@ -291,12 +291,15 @@ namespace libtorrent { namespace detail
, print.begin() + print.length() , print.begin() + print.length()
, m_peer_id.begin()); , m_peer_id.begin());
// http-accepted characters:
static char const printable[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'()";
// the random number // the random number
for (unsigned char* i = m_peer_id.begin() + print.length(); for (unsigned char* i = m_peer_id.begin() + print.length();
i != m_peer_id.end(); i != m_peer_id.end();
++i) ++i)
{ {
*i = rand(); *i = printable[rand() % (sizeof(printable)-1)];
} }
} }

View File

@ -1178,10 +1178,26 @@ namespace libtorrent
} }
catch (file_error&) catch (file_error&)
{ {
// TODO: skip the whole file here! // find the file that failed, and skip all the blocks in that file
// this means the slot wasn't allocated size_type file_offset = 0;
assert(m_slot_to_piece[current_slot] == unallocated); size_type current_offset = current_slot * m_info.piece_length();
m_unallocated_slots.push_back(current_slot); for (torrent_info::file_iterator i = m_info.begin_files();
i != m_info.end_files(); ++i)
{
file_offset += i->size;
if (file_offset > current_offset) break;
}
assert(file_offset > current_offset);
int skip_blocks = (file_offset - current_offset + m_info.piece_length() - 1)
/ m_info.piece_length();
for (int i = current_slot; i < current_slot + skip_blocks; ++i)
{
assert(m_slot_to_piece[i] == unallocated);
m_unallocated_slots.push_back(i);
}
current_slot += skip_blocks;
} }
// Update progress meter and check if we've been requested to abort // Update progress meter and check if we've been requested to abort