test: add plaintext & encrypted handshake tests (#3455)

This commit is contained in:
Charles Kerr
2022-07-16 15:25:44 -05:00
committed by GitHub
parent 46874dff91
commit fe91f04351
8 changed files with 484 additions and 63 deletions

View File

@@ -112,6 +112,8 @@ public:
return inbuf.get();
}
void readBufferAdd(void const* data, size_t n_bytes);
[[nodiscard]] auto hasBandwidthLeft(tr_direction dir) noexcept
{
return bandwidth_.clamp(dir, 1024) > 0;
@@ -304,6 +306,19 @@ tr_peerIo* tr_peerIoNewIncoming(
time_t current_time,
struct tr_peer_socket const socket);
// this is only public for testing purposes.
// production code should use tr_peerIoNewOutgoing() or tr_peerIoNewIncoming()
tr_peerIo* tr_peerIoNew(
tr_session* session,
tr_bandwidth* parent,
tr_address const* addr,
tr_port port,
time_t current_time,
tr_sha1_digest_t const* torrent_hash,
bool is_incoming,
bool is_seed,
struct tr_peer_socket const socket);
void tr_peerIoRefImpl(char const* file, int line, tr_peerIo* io);
#define tr_peerIoRef(io) tr_peerIoRefImpl(__FILE__, __LINE__, (io))