forked from premiere/premiere-libtorrent
fix more warnings
This commit is contained in:
parent
3aa63d3f27
commit
5c8fc818c1
|
@ -200,6 +200,7 @@ namespace libtorrent
|
|||
struct TORRENT_EXTRA_EXPORT ipv4_peer : torrent_peer
|
||||
{
|
||||
ipv4_peer(tcp::endpoint const& ip, bool connectable, int src);
|
||||
ipv4_peer(ipv4_peer const& p);
|
||||
|
||||
address_v4 addr;
|
||||
private:
|
||||
|
@ -214,6 +215,7 @@ namespace libtorrent
|
|||
|
||||
char* destination;
|
||||
private:
|
||||
i2p_peer(const i2p_peer&);
|
||||
i2p_peer& operator=(i2p_peer const&);
|
||||
};
|
||||
#endif
|
||||
|
@ -227,6 +229,7 @@ namespace libtorrent
|
|||
private:
|
||||
// explicitly disallow assignment, to silence msvc warning
|
||||
ipv6_peer& operator=(ipv6_peer const&);
|
||||
ipv6_peer(ipv6_peer const&);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ namespace libtorrent
|
|||
m_job_cond.notify_all();
|
||||
m_hash_job_cond.notify_all();
|
||||
l.unlock();
|
||||
if (wait) for (int i = m_num_threads; i < m_threads.size(); ++i) m_threads[i]->join();
|
||||
if (wait) for (int j = m_num_threads; j < m_threads.size(); ++j) m_threads[j]->join();
|
||||
// this will detach the threads
|
||||
m_threads.resize(m_num_threads);
|
||||
}
|
||||
|
@ -531,8 +531,8 @@ namespace libtorrent
|
|||
--pe->piece_refcount;
|
||||
m_disk_cache.maybe_free_piece(pe);
|
||||
}
|
||||
int num_blocks = iovec_offset[i+1] - iovec_offset[i];
|
||||
iovec_flushed(pe, flushing + iovec_offset[i], num_blocks
|
||||
const int block_diff = iovec_offset[i+1] - iovec_offset[i];
|
||||
iovec_flushed(pe, flushing + iovec_offset[i], block_diff
|
||||
, block_start, error, completed_jobs);
|
||||
block_start += p->blocks_in_piece;
|
||||
}
|
||||
|
@ -1121,7 +1121,7 @@ namespace libtorrent
|
|||
|
||||
if (ret == retry_job)
|
||||
{
|
||||
mutex::scoped_lock l(m_job_mutex);
|
||||
mutex::scoped_lock l2(m_job_mutex);
|
||||
// to avoid busy looping here, give up
|
||||
// our quanta in case there aren't any other
|
||||
// jobs to run in between
|
||||
|
@ -1129,12 +1129,12 @@ namespace libtorrent
|
|||
// TODO: a potentially more efficient solution would be to have a special
|
||||
// queue for retry jobs, that's only ever run when a job completes, in
|
||||
// any thread. It would only work if counters::num_running_disk_jobs > 0
|
||||
|
||||
|
||||
TORRENT_ASSERT((j->flags & disk_io_job::in_progress) || !j->storage);
|
||||
|
||||
|
||||
bool need_sleep = m_queued_jobs.empty();
|
||||
m_queued_jobs.push_back(j);
|
||||
l.unlock();
|
||||
l2.unlock();
|
||||
if (need_sleep) sleep(0);
|
||||
return;
|
||||
}
|
||||
|
@ -1177,10 +1177,10 @@ namespace libtorrent
|
|||
|
||||
int file_flags = file_flags_for_job(j);
|
||||
file::iovec_t b = { j->buffer.disk_block, size_t(j->d.io.buffer_size) };
|
||||
|
||||
|
||||
int ret = j->storage->get_storage_impl()->readv(&b, 1
|
||||
, j->piece, j->d.io.offset, file_flags, j->error);
|
||||
|
||||
|
||||
TORRENT_ASSERT(ret >= 0 || j->error.ec);
|
||||
|
||||
if (!j->error.ec)
|
||||
|
@ -1260,8 +1260,8 @@ namespace libtorrent
|
|||
{
|
||||
ret = do_uncached_read(j);
|
||||
|
||||
mutex::scoped_lock l(m_cache_mutex);
|
||||
cached_piece_entry* pe = m_disk_cache.find_piece(j);
|
||||
mutex::scoped_lock l2(m_cache_mutex);
|
||||
pe = m_disk_cache.find_piece(j);
|
||||
if (pe) maybe_issue_queued_read_jobs(pe, completed_jobs);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1304,7 +1304,7 @@ namespace libtorrent
|
|||
// read failed. free buffers and return error
|
||||
m_disk_cache.free_iovec(iov, iov_len);
|
||||
|
||||
cached_piece_entry* pe = m_disk_cache.find_piece(j);
|
||||
pe = m_disk_cache.find_piece(j);
|
||||
if (pe == NULL)
|
||||
{
|
||||
// the piece is supposed to be allocated when the
|
||||
|
@ -1723,15 +1723,15 @@ namespace libtorrent
|
|||
mutex::scoped_lock l(m_cache_mutex);
|
||||
// if we succeed in adding the block to the cache, the job will
|
||||
// be added along with it. we may not free j if so
|
||||
cached_piece_entry* pe = m_disk_cache.add_dirty_block(j);
|
||||
cached_piece_entry* dpe = m_disk_cache.add_dirty_block(j);
|
||||
|
||||
// if the buffer was successfully added to the cache
|
||||
// our holder should no longer own it
|
||||
if (pe) buffer.release();
|
||||
if (dpe) buffer.release();
|
||||
|
||||
if (pe && pe->outstanding_flush == 0)
|
||||
if (dpe && dpe->outstanding_flush == 0)
|
||||
{
|
||||
pe->outstanding_flush = 1;
|
||||
dpe->outstanding_flush = 1;
|
||||
l.unlock();
|
||||
|
||||
// the block and write job were successfully inserted
|
||||
|
@ -1744,7 +1744,7 @@ namespace libtorrent
|
|||
}
|
||||
// if we added the block (regardless of whether we also
|
||||
// issued a flush job or not), we're done.
|
||||
if (pe) return;
|
||||
if (dpe) return;
|
||||
l.unlock();
|
||||
}
|
||||
|
||||
|
@ -2222,9 +2222,9 @@ namespace libtorrent
|
|||
|
||||
for (tailqueue_iterator i = hash_jobs.iterate(); i.get(); i.next())
|
||||
{
|
||||
disk_io_job* j = (disk_io_job*)i.get();
|
||||
memcpy(j->d.piece_hash, &result[0], 20);
|
||||
j->ret = 0;
|
||||
disk_io_job* hj = (disk_io_job*)i.get();
|
||||
memcpy(hj->d.piece_hash, result.data(), 20);
|
||||
hj->ret = 0;
|
||||
}
|
||||
|
||||
delete pe->hash;
|
||||
|
@ -2278,10 +2278,10 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
offset += block_size;
|
||||
h.update((char const*)iov.iov_base, iov.iov_len);
|
||||
h.update(static_cast<char const*>(iov.iov_base), iov.iov_len);
|
||||
}
|
||||
|
||||
m_disk_cache.free_buffer((char*)iov.iov_base);
|
||||
m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base));
|
||||
|
||||
sha1_hash piece_hash = h.final();
|
||||
memcpy(j->d.piece_hash, &piece_hash[0], 20);
|
||||
|
@ -2436,8 +2436,8 @@ namespace libtorrent
|
|||
// and decrements the piece_refcount
|
||||
|
||||
// decrement the refcounts of the blocks we just hashed
|
||||
for (int i = 0; i < num_locked_blocks; ++i)
|
||||
m_disk_cache.dec_block_refcount(pe, locked_blocks[i], block_cache::ref_hashing);
|
||||
for (int k = 0; k < num_locked_blocks; ++k)
|
||||
m_disk_cache.dec_block_refcount(pe, locked_blocks[k], block_cache::ref_hashing);
|
||||
|
||||
--pe->piece_refcount;
|
||||
pe->hashing = false;
|
||||
|
@ -2461,7 +2461,7 @@ namespace libtorrent
|
|||
|
||||
if (ret < 0)
|
||||
{
|
||||
m_disk_cache.free_buffer((char*)iov.iov_base);
|
||||
m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base));
|
||||
l.lock();
|
||||
break;
|
||||
}
|
||||
|
@ -2493,7 +2493,7 @@ namespace libtorrent
|
|||
|
||||
TORRENT_PIECE_ASSERT(ph->offset == i * block_size, pe);
|
||||
ph->offset += iov.iov_len;
|
||||
ph->h.update((char const*)iov.iov_base, iov.iov_len);
|
||||
ph->h.update(static_cast<char const*>(iov.iov_base), iov.iov_len);
|
||||
|
||||
l.lock();
|
||||
m_disk_cache.insert_blocks(pe, i, &iov, 1, j);
|
||||
|
@ -3471,8 +3471,8 @@ namespace libtorrent
|
|||
&& m_settings.get_bool(settings_pack::use_read_cache)
|
||||
&& m_settings.get_int(settings_pack::cache_size) > 0)
|
||||
{
|
||||
int ret = prep_read_job_impl(j, false);
|
||||
switch (ret)
|
||||
int state = prep_read_job_impl(j, false);
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
completed_jobs.push_back(j);
|
||||
|
@ -3571,7 +3571,7 @@ namespace libtorrent
|
|||
disk_io_job* j = (disk_io_job*)m_completed_jobs.get_all();
|
||||
l.unlock();
|
||||
|
||||
uncork_interface* uncork = (uncork_interface*)userdata;
|
||||
uncork_interface* uncork = static_cast<uncork_interface*>(userdata);
|
||||
std::vector<disk_io_job*> to_delete;
|
||||
to_delete.reserve(num_jobs);
|
||||
|
||||
|
|
|
@ -303,7 +303,8 @@ namespace libtorrent
|
|||
void file_pool::mark_deleted(file_storage const& fs)
|
||||
{
|
||||
mutex::scoped_lock l(m_mutex);
|
||||
m_deleted_storages.push_back(std::make_pair(fs.name(), (void const*)&fs));
|
||||
m_deleted_storages.push_back(std::make_pair(fs.name()
|
||||
, static_cast<void const*>(&fs)));
|
||||
if(m_deleted_storages.size() > 100)
|
||||
m_deleted_storages.erase(m_deleted_storages.begin());
|
||||
}
|
||||
|
|
|
@ -6651,29 +6651,29 @@ namespace libtorrent
|
|||
// make sure this peer is not a dangling pointer
|
||||
TORRENT_ASSERT(m_ses.has_peer(*i));
|
||||
peer_connection const& p = *(*i);
|
||||
for (std::vector<pending_block>::const_iterator i = p.request_queue().begin()
|
||||
, end(p.request_queue().end()); i != end; ++i)
|
||||
for (std::vector<pending_block>::const_iterator j = p.request_queue().begin()
|
||||
, end(p.request_queue().end()); j != end; ++j)
|
||||
{
|
||||
++num_requests[i->block].num_peers;
|
||||
++num_requests[i->block].num_peers_with_timeouts;
|
||||
++num_requests[i->block].num_peers_with_nowant;
|
||||
++num_requests[i->block].num_not_requested;
|
||||
// num_requests[i->block].peers.push_back(&p);
|
||||
++num_requests[j->block].num_peers;
|
||||
++num_requests[j->block].num_peers_with_timeouts;
|
||||
++num_requests[j->block].num_peers_with_nowant;
|
||||
++num_requests[j->block].num_not_requested;
|
||||
// num_requests[j->block].peers.push_back(&p);
|
||||
}
|
||||
for (std::vector<pending_block>::const_iterator i = p.download_queue().begin()
|
||||
, end(p.download_queue().end()); i != end; ++i)
|
||||
for (std::vector<pending_block>::const_iterator j = p.download_queue().begin()
|
||||
, end(p.download_queue().end()); j != end; ++j)
|
||||
{
|
||||
if (!i->not_wanted && !i->timed_out) ++num_requests[i->block].num_peers;
|
||||
if (i->timed_out) ++num_requests[i->block].num_peers_with_timeouts;
|
||||
if (i->not_wanted) ++num_requests[i->block].num_peers_with_nowant;
|
||||
// num_requests[i->block].peers.push_back(&p);
|
||||
if (!j->not_wanted && !j->timed_out) ++num_requests[j->block].num_peers;
|
||||
if (j->timed_out) ++num_requests[j->block].num_peers_with_timeouts;
|
||||
if (j->not_wanted) ++num_requests[j->block].num_peers_with_nowant;
|
||||
// num_requests[j->block].peers.push_back(&p);
|
||||
}
|
||||
}
|
||||
for (std::map<piece_block, peer_count_t>::iterator i = num_requests.begin()
|
||||
, end(num_requests.end()); i != end; ++i)
|
||||
for (std::map<piece_block, peer_count_t>::iterator j = num_requests.begin()
|
||||
, end(num_requests.end()); j != end; ++j)
|
||||
{
|
||||
piece_block b = i->first;
|
||||
peer_count_t const& pc = i->second;
|
||||
piece_block b = j->first;
|
||||
peer_count_t const& pc = j->second;
|
||||
int count = pc.num_peers;
|
||||
int count_with_timeouts = pc.num_peers_with_timeouts;
|
||||
int count_with_nowant = pc.num_peers_with_nowant;
|
||||
|
|
|
@ -235,6 +235,9 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
ipv4_peer::ipv4_peer(ipv4_peer const& p)
|
||||
: torrent_peer(p), addr(p.addr) {}
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
i2p_peer::i2p_peer(char const* dest, bool connectable, int src)
|
||||
: torrent_peer(0, connectable, src), destination(allocate_string_copy(dest))
|
||||
|
|
|
@ -356,7 +356,7 @@ struct utp_socket_impl
|
|||
enum packet_flags_t { pkt_ack = 1, pkt_fin = 2 };
|
||||
bool send_pkt(int flags = 0);
|
||||
bool resend_packet(packet* p, bool fast_resend = false);
|
||||
void send_reset(utp_header* ph);
|
||||
void send_reset(utp_header const* ph);
|
||||
void parse_sack(boost::uint16_t packet_ack, boost::uint8_t const* ptr
|
||||
, int size, int* acked_bytes, time_point const now, boost::uint32_t& min_rtt);
|
||||
void parse_close_reason(boost::uint8_t const* ptr, int size);
|
||||
|
@ -753,7 +753,8 @@ void utp_init_mtu(utp_socket_impl* s, int link_mtu, int utp_mtu)
|
|||
bool utp_incoming_packet(utp_socket_impl* s, char const* p
|
||||
, int size, udp::endpoint const& ep, time_point receive_time)
|
||||
{
|
||||
return s->incoming_packet((boost::uint8_t const*)p, size, ep, receive_time);
|
||||
return s->incoming_packet(reinterpret_cast<boost::uint8_t const*>(p), size
|
||||
, ep, receive_time);
|
||||
}
|
||||
|
||||
bool utp_match(utp_socket_impl* s, udp::endpoint const& ep, boost::uint16_t id)
|
||||
|
@ -1025,7 +1026,7 @@ void utp_stream::add_write_buffer(void const* buf, size_t len)
|
|||
TORRENT_ASSERT(m_impl->m_write_buffer_size == write_buffer_size);
|
||||
#endif
|
||||
|
||||
m_impl->m_write_buffer.push_back(utp_socket_impl::iovec_t((void*)buf, len));
|
||||
m_impl->m_write_buffer.push_back(utp_socket_impl::iovec_t(const_cast<void*>(buf), len));
|
||||
m_impl->m_write_buffer_size += len;
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
@ -1463,7 +1464,7 @@ void utp_socket_impl::send_fin()
|
|||
#endif
|
||||
}
|
||||
|
||||
void utp_socket_impl::send_reset(utp_header* ph)
|
||||
void utp_socket_impl::send_reset(utp_header const* ph)
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
|
@ -1643,7 +1644,7 @@ void utp_socket_impl::write_payload(boost::uint8_t* ptr, int size)
|
|||
i->len -= to_copy;
|
||||
TORRENT_ASSERT(m_write_buffer_size >= to_copy);
|
||||
m_write_buffer_size -= to_copy;
|
||||
((char const*&)i->buf) += to_copy;
|
||||
i->buf = static_cast<char*>(i->buf) + to_copy;
|
||||
if (i->len == 0) ++buffers_to_clear;
|
||||
++i;
|
||||
}
|
||||
|
@ -1654,10 +1655,10 @@ void utp_socket_impl::write_payload(boost::uint8_t* ptr, int size)
|
|||
|
||||
#ifdef TORRENT_DEBUG
|
||||
write_buffer_size = 0;
|
||||
for (std::vector<iovec_t>::iterator i = m_write_buffer.begin()
|
||||
, end(m_write_buffer.end()); i != end; ++i)
|
||||
for (std::vector<iovec_t>::iterator j = m_write_buffer.begin()
|
||||
, end(m_write_buffer.end()); j != end; ++j)
|
||||
{
|
||||
write_buffer_size += i->len;
|
||||
write_buffer_size += j->len;
|
||||
}
|
||||
TORRENT_ASSERT(m_write_buffer_size == write_buffer_size);
|
||||
#endif
|
||||
|
@ -1691,7 +1692,7 @@ void utp_socket_impl::remove_sack_header(packet* p)
|
|||
|
||||
// remove the sack header
|
||||
boost::uint8_t* ptr = p->buf + sizeof(utp_header);
|
||||
utp_header* h = (utp_header*)p->buf;
|
||||
utp_header* h = reinterpret_cast<utp_header*>(p->buf);
|
||||
|
||||
TORRENT_ASSERT(h->extension == utp_sack);
|
||||
|
||||
|
@ -1730,6 +1731,10 @@ struct holder
|
|||
|
||||
private:
|
||||
|
||||
// not copyable
|
||||
holder(holder const&);
|
||||
holder& operator=(holder const&);
|
||||
|
||||
char* m_buf;
|
||||
};
|
||||
|
||||
|
@ -1864,11 +1869,11 @@ bool utp_socket_impl::send_pkt(int flags)
|
|||
{
|
||||
// we only need a heap allocation if we have payload and
|
||||
// need to keep the packet around (in the outbuf)
|
||||
if (payload_size)
|
||||
if (payload_size)
|
||||
{
|
||||
p = (packet*)malloc(sizeof(packet) + m_mtu);
|
||||
p = static_cast<packet*>(malloc(sizeof(packet) + m_mtu));
|
||||
p->allocated = m_mtu;
|
||||
buf_holder.reset((char*)p);
|
||||
buf_holder.reset(reinterpret_cast<char*>(p));
|
||||
|
||||
m_sm->inc_stats_counter(counters::utp_payload_pkts_out);
|
||||
}
|
||||
|
@ -1896,7 +1901,7 @@ bool utp_socket_impl::send_pkt(int flags)
|
|||
#endif
|
||||
p->need_resend = false;
|
||||
ptr = p->buf;
|
||||
h = (utp_header*)ptr;
|
||||
h = reinterpret_cast<utp_header*>(ptr);
|
||||
ptr += sizeof(utp_header);
|
||||
|
||||
h->extension = sack ? utp_sack
|
||||
|
@ -1916,7 +1921,7 @@ bool utp_socket_impl::send_pkt(int flags)
|
|||
p = m_nagle_packet;
|
||||
|
||||
ptr = p->buf + sizeof(utp_header);
|
||||
h = (utp_header*)p->buf;
|
||||
h = reinterpret_cast<utp_header*>(p->buf);
|
||||
TORRENT_ASSERT(h->seq_nr == m_seq_nr);
|
||||
|
||||
// if the packet has a selective force header, we'll need
|
||||
|
@ -2120,7 +2125,7 @@ bool utp_socket_impl::send_pkt(int flags)
|
|||
packet* old = m_outbuf.insert(m_seq_nr, p);
|
||||
if (old)
|
||||
{
|
||||
TORRENT_ASSERT(((utp_header*)old->buf)->seq_nr == m_seq_nr);
|
||||
TORRENT_ASSERT(reinterpret_cast<utp_header*>(old->buf)->seq_nr == m_seq_nr);
|
||||
if (!old->need_resend) m_bytes_in_flight -= old->size - old->header_size;
|
||||
free(old);
|
||||
}
|
||||
|
@ -2210,7 +2215,7 @@ bool utp_socket_impl::resend_packet(packet* p, bool fast_resend)
|
|||
if (fast_resend) ++p->num_fast_resend;
|
||||
#endif
|
||||
p->need_resend = false;
|
||||
utp_header* h = (utp_header*)p->buf;
|
||||
utp_header* h = reinterpret_cast<utp_header*>(p->buf);
|
||||
// update packet header
|
||||
h->timestamp_difference_microseconds = m_reply_micro;
|
||||
p->send_time = clock_type::now();
|
||||
|
@ -2239,7 +2244,7 @@ bool utp_socket_impl::resend_packet(packet* p, bool fast_resend)
|
|||
|
||||
error_code ec;
|
||||
m_sm->send_packet(udp::endpoint(m_remote_address, m_port)
|
||||
, (char const*)p->buf, p->size, ec);
|
||||
, reinterpret_cast<char const*>(p->buf), p->size, ec);
|
||||
++m_out_packets;
|
||||
m_sm->inc_stats_counter(counters::utp_packets_out);
|
||||
|
||||
|
@ -2369,7 +2374,7 @@ void utp_socket_impl::ack_packet(packet* p, time_point const& receive_time
|
|||
|
||||
// verify that the packet we're removing was in fact sent
|
||||
// with the sequence number we expect
|
||||
TORRENT_ASSERT(((utp_header*)p->buf)->seq_nr == seq_nr);
|
||||
TORRENT_ASSERT(reinterpret_cast<utp_header*>(p->buf)->seq_nr == seq_nr);
|
||||
|
||||
if (!p->need_resend)
|
||||
{
|
||||
|
@ -2427,7 +2432,7 @@ void utp_socket_impl::incoming(boost::uint8_t const* buf, int size, packet* p
|
|||
int to_copy = (std::min)(size, int(target->len));
|
||||
memcpy(target->buf, buf, to_copy);
|
||||
m_read += to_copy;
|
||||
target->buf = ((boost::uint8_t*)target->buf) + to_copy;
|
||||
target->buf = reinterpret_cast<boost::uint8_t*>(target->buf) + to_copy;
|
||||
target->len -= to_copy;
|
||||
buf += to_copy;
|
||||
UTP_LOGV("%8p: copied %d bytes into user receive buffer\n", this, to_copy);
|
||||
|
@ -2454,7 +2459,7 @@ void utp_socket_impl::incoming(boost::uint8_t const* buf, int size, packet* p
|
|||
if (!p)
|
||||
{
|
||||
TORRENT_ASSERT(buf);
|
||||
p = (packet*)malloc(sizeof(packet) + size);
|
||||
p = static_cast<packet*>(malloc(sizeof(packet) + size));
|
||||
p->size = size;
|
||||
p->header_size = 0;
|
||||
memcpy(p->buf, buf, size);
|
||||
|
@ -2588,7 +2593,7 @@ bool utp_socket_impl::consume_incoming_data(
|
|||
}
|
||||
|
||||
// we don't need to save the packet header, just the payload
|
||||
packet* p = (packet*)malloc(sizeof(packet) + payload_size);
|
||||
packet* p = static_cast<packet*>(malloc(sizeof(packet) + payload_size));
|
||||
p->size = payload_size;
|
||||
p->header_size = 0;
|
||||
p->num_transmissions = 0;
|
||||
|
@ -2684,7 +2689,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
utp_header* ph = (utp_header*)buf;
|
||||
utp_header const* ph = reinterpret_cast<utp_header const*>(buf);
|
||||
|
||||
m_sm->inc_stats_counter(counters::utp_packets_in);
|
||||
|
||||
|
@ -3074,8 +3079,6 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
TORRENT_ASSERT(m_recv_id == ((m_send_id + 1) & 0xffff));
|
||||
|
||||
defer_ack();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3083,7 +3086,6 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
UTP_LOG("%8p: ERROR: type:%s state:%s (ignored)\n"
|
||||
, this, packet_type_names[ph->get_type()], socket_state_names[m_state]);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3096,7 +3098,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
UTP_LOGV("%8p: incorrect ack_nr (%d) waiting for %d\n"
|
||||
, this, int(ph->ack_nr), (m_seq_nr - 1) & ACK_MASK);
|
||||
#endif
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
TORRENT_ASSERT(!m_error);
|
||||
|
@ -3272,7 +3274,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case UTP_STATE_FIN_SENT:
|
||||
{
|
||||
|
@ -3334,7 +3336,9 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
// data, and we can gracefully shut down.
|
||||
|
||||
if (consume_incoming_data(ph, ptr, payload_size, receive_time))
|
||||
return true;
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_acked_seq_nr == ((m_seq_nr - 1) & ACK_MASK))
|
||||
{
|
||||
|
@ -3359,18 +3363,17 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case UTP_STATE_DELETE:
|
||||
default:
|
||||
{
|
||||
// respond with a reset
|
||||
send_reset(ph);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void utp_socket_impl::do_ledbat(const int acked_bytes, const int delay
|
||||
|
@ -3704,7 +3707,7 @@ void utp_socket_impl::check_invariant() const
|
|||
{
|
||||
TORRENT_ASSERT(p->mtu_probe);
|
||||
}
|
||||
TORRENT_ASSERT(((utp_header*)p->buf)->seq_nr == i);
|
||||
TORRENT_ASSERT(reinterpret_cast<utp_header*>(p->buf)->seq_nr == i);
|
||||
}
|
||||
|
||||
if (m_nagle_packet)
|
||||
|
|
Loading…
Reference in New Issue