mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-08 22:08:00 +00:00
bugfix. this was a tough one. because the observer was already dequeued
from m_transactions, we need to properly terminate it in some way. usually we go through the end of the function, where reply() does done(). however there are some error cases where function may returns sooner. this might be unlikely to occur in original upstream code (missing 'r' key, missing 'id'), but with IP enforcing it is not so uncommon. hopefully this will fix #32.
This commit is contained in:
parent
d19fef0028
commit
35fa3832e8
@ -326,6 +326,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id)
|
||||
entry e;
|
||||
incoming_error(e, "missing 'r' key");
|
||||
m_sock->send_packet(e, m.addr, 0);
|
||||
o->timeout();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -335,6 +336,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id)
|
||||
entry e;
|
||||
incoming_error(e, "missing 'id' key");
|
||||
m_sock->send_packet(e, m.addr, 0);
|
||||
o->timeout();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -348,6 +350,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id)
|
||||
m_observer->set_external_address(address_v4(b)
|
||||
, m.addr.address());
|
||||
// [MF] enforced: no valid response is sent along with "ip".
|
||||
o->timeout();
|
||||
return false;
|
||||
}
|
||||
#if TORRENT_USE_IPV6
|
||||
@ -360,6 +363,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id)
|
||||
m_observer->set_external_address(address_v6(b)
|
||||
, m.addr.address());
|
||||
// [MF] enforced: no valid response is sent along with "ip".
|
||||
o->timeout();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -505,10 +509,7 @@ observer::~observer()
|
||||
// reported back to the traversal_algorithm as
|
||||
// well. If it wasn't sent, it cannot have been
|
||||
// reported back
|
||||
/* [MF] this assert seems too strict. Some usages of rpc_manager::invoke, for
|
||||
* example, don't test the return value (false) which indicates that packet was not sent.
|
||||
TORRENT_ASSERT(m_was_sent == bool(flags & flag_done) || m_was_abandoned);
|
||||
*/
|
||||
TORRENT_ASSERT(!m_in_constructor);
|
||||
#if defined TORRENT_DEBUG || TORRENT_RELEASE_ASSERTS
|
||||
TORRENT_ASSERT(m_in_use);
|
||||
|
Loading…
Reference in New Issue
Block a user