|
|
@ -540,11 +540,18 @@ namespace libtorrent |
|
|
|
|
|
|
|
|
|
|
|
std::string postStr(static_cast<char *>(bufs[0].iov_base), bufs[0].iov_len); |
|
|
|
std::string postStr(static_cast<char *>(bufs[0].iov_base), bufs[0].iov_len); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int tries = 2; |
|
|
|
|
|
|
|
while( tries-- ) { |
|
|
|
|
|
|
|
try { |
|
|
|
if( Write(std::make_pair('p', slot), postStr) ) { |
|
|
|
if( Write(std::make_pair('p', slot), postStr) ) { |
|
|
|
return postStr.size(); |
|
|
|
return postStr.size(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch( leveldb_error &e ) { |
|
|
|
|
|
|
|
RepairDB(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -572,6 +579,9 @@ namespace libtorrent |
|
|
|
TORRENT_ASSERT(num_bufs == 1); |
|
|
|
TORRENT_ASSERT(num_bufs == 1); |
|
|
|
TORRENT_ASSERT(offset == 0); |
|
|
|
TORRENT_ASSERT(offset == 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int tries = 2; |
|
|
|
|
|
|
|
while( tries-- ) { |
|
|
|
|
|
|
|
try { |
|
|
|
std::string postStr; |
|
|
|
std::string postStr; |
|
|
|
if( Read(std::make_pair('p', slot), postStr) ) { |
|
|
|
if( Read(std::make_pair('p', slot), postStr) ) { |
|
|
|
TORRENT_ASSERT(bufs[0].iov_len >= postStr.size()); |
|
|
|
TORRENT_ASSERT(bufs[0].iov_len >= postStr.size()); |
|
|
@ -580,6 +590,10 @@ namespace libtorrent |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch( leveldb_error &e ) { |
|
|
|
|
|
|
|
RepairDB(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int default_storage::write( |
|
|
|
int default_storage::write( |
|
|
|