forked from premiere/premiere-libtorrent
fixed span::fist logic and minor cleanup (#960)
This commit is contained in:
parent
98918d61f5
commit
68b1fc2fe8
|
@ -451,4 +451,3 @@ private:
|
|||
}
|
||||
|
||||
#endif // TORRENT_BT_PEER_CONNECTION_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -162,10 +162,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <vector>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/buffer.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/sha1_hash.hpp" // for sha1_hash
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/session_handle.hpp"
|
||||
#include "libtorrent/peer_connection_handle.hpp"
|
||||
#include "libtorrent/span.hpp"
|
||||
|
@ -268,7 +265,7 @@ namespace libtorrent
|
|||
{ return std::numeric_limits<uint64_t>::max(); }
|
||||
|
||||
// called when saving settings state
|
||||
virtual void save_state(entry&) const {}
|
||||
virtual void save_state(entry&) {}
|
||||
|
||||
// called when loading settings state
|
||||
virtual void load_state(bdecode_node const&) {}
|
||||
|
|
|
@ -47,7 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
// TODO: hide these declarations when deprecaated functions are disabled, and
|
||||
// TODO: hide these declarations when deprecated functions are disabled, and
|
||||
// expose them internally in a header under aux_.
|
||||
|
||||
// these functions don't really need to be public. This mechanism of
|
||||
|
@ -70,4 +70,3 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
#endif // TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace libtorrent
|
|||
span<T> first(size_t const n) const
|
||||
{
|
||||
TORRENT_ASSERT(size() >= n);
|
||||
return { data(), size() - n };
|
||||
return { data(), n };
|
||||
}
|
||||
|
||||
span<T> last(size_t const n) const
|
||||
|
|
|
@ -64,7 +64,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/aux_/io.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/version.hpp"
|
||||
#include "libtorrent/extensions.hpp"
|
||||
#include "libtorrent/aux_/session_interface.hpp"
|
||||
#include "libtorrent/alert_types.hpp"
|
||||
|
@ -753,7 +752,7 @@ namespace libtorrent
|
|||
|
||||
// add handshake to the send buffer
|
||||
const char version_string[] = "BitTorrent protocol";
|
||||
const int string_len = sizeof(version_string)-1;
|
||||
const int string_len = sizeof(version_string) - 1;
|
||||
|
||||
char handshake[1 + string_len + 8 + 20 + 20];
|
||||
char* ptr = handshake;
|
||||
|
|
|
@ -745,7 +745,7 @@ void http_connection::on_read(error_code const& e
|
|||
{
|
||||
span<char const> rcv_buf(m_recvbuffer);
|
||||
bool error = false;
|
||||
m_parser.incoming(rcv_buf.subspan(0, m_read_pos), error);
|
||||
m_parser.incoming(rcv_buf.first(m_read_pos), error);
|
||||
if (error)
|
||||
{
|
||||
// HTTP parse error
|
||||
|
|
|
@ -320,7 +320,7 @@ span<char const> crypto_receive_buffer::get() const
|
|||
{
|
||||
span<char const> recv_buffer = m_connection_buffer.get();
|
||||
if (m_recv_pos < m_connection_buffer.pos())
|
||||
recv_buffer = recv_buffer.subspan(0, m_recv_pos);
|
||||
recv_buffer = recv_buffer.first(m_recv_pos);
|
||||
return recv_buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue