Minor refactor in direct_traversal and some typos in bdecode header.
This commit is contained in:
parent
161f3d8c65
commit
cf4c8d0058
|
@ -104,7 +104,7 @@ namespace bdecode_errors
|
||||||
{
|
{
|
||||||
// libtorrent uses boost.system's ``error_code`` class to represent
|
// libtorrent uses boost.system's ``error_code`` class to represent
|
||||||
// errors. libtorrent has its own error category get_bdecode_category()
|
// errors. libtorrent has its own error category get_bdecode_category()
|
||||||
// whith the error codes defined by error_code_enum.
|
// with the error codes defined by error_code_enum.
|
||||||
enum error_code_enum
|
enum error_code_enum
|
||||||
{
|
{
|
||||||
// Not an error
|
// Not an error
|
||||||
|
@ -233,7 +233,7 @@ struct bdecode_token
|
||||||
|
|
||||||
// Sometimes it's important to get a non-owning reference to the root node (
|
// Sometimes it's important to get a non-owning reference to the root node (
|
||||||
// to be able to copy it as a reference for instance). For that, use the
|
// to be able to copy it as a reference for instance). For that, use the
|
||||||
// non_owninig() member function.
|
// non_owning() member function.
|
||||||
//
|
//
|
||||||
// There are 5 different types of nodes, see type_t.
|
// There are 5 different types of nodes, see type_t.
|
||||||
struct TORRENT_EXPORT bdecode_node
|
struct TORRENT_EXPORT bdecode_node
|
||||||
|
@ -250,7 +250,7 @@ struct TORRENT_EXPORT bdecode_node
|
||||||
bdecode_node(bdecode_node const&);
|
bdecode_node(bdecode_node const&);
|
||||||
bdecode_node& operator=(bdecode_node const&);
|
bdecode_node& operator=(bdecode_node const&);
|
||||||
|
|
||||||
// the dypes of bdecoded nodes
|
// the types of bdecoded nodes
|
||||||
enum type_t
|
enum type_t
|
||||||
{
|
{
|
||||||
// uninitialized or default constructed. This is also used
|
// uninitialized or default constructed. This is also used
|
||||||
|
|
|
@ -30,8 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBTORRENT_DIRECT_REQUEST_HPP
|
#ifndef TORRENT_DIRECT_REQUEST_HPP
|
||||||
#define LIBTORRENT_DIRECT_REQUEST_HPP
|
#define TORRENT_DIRECT_REQUEST_HPP
|
||||||
|
|
||||||
#include <boost/function/function1.hpp>
|
#include <boost/function/function1.hpp>
|
||||||
#include <libtorrent/kademlia/msg.hpp>
|
#include <libtorrent/kademlia/msg.hpp>
|
||||||
|
@ -42,9 +42,11 @@ namespace libtorrent { namespace dht
|
||||||
|
|
||||||
struct direct_traversal : traversal_algorithm
|
struct direct_traversal : traversal_algorithm
|
||||||
{
|
{
|
||||||
|
typedef boost::function<void(dht::msg const&)> message_callback;
|
||||||
|
|
||||||
direct_traversal(node& node
|
direct_traversal(node& node
|
||||||
, node_id target
|
, node_id target
|
||||||
, boost::function<void(msg const&)> cb)
|
, message_callback cb)
|
||||||
: traversal_algorithm(node, target)
|
: traversal_algorithm(node, target)
|
||||||
, m_cb(cb)
|
, m_cb(cb)
|
||||||
{}
|
{}
|
||||||
|
@ -62,7 +64,7 @@ struct direct_traversal : traversal_algorithm
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
boost::function<void(msg const&)> m_cb;
|
message_callback m_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct direct_observer : observer
|
struct direct_observer : observer
|
||||||
|
@ -88,6 +90,6 @@ struct direct_observer : observer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} } // namespace libtorrent::dht
|
}} // namespace libtorrent::dht
|
||||||
|
|
||||||
#endif
|
#endif //TORRENT_DIRECT_REQUEST_HPP
|
||||||
|
|
Loading…
Reference in New Issue