mirror of
https://github.com/transmission/transmission.git
synced 2026-10-09 18:49:19 +02:00
* refactor: `tr_peer_socket` as abstract base class * refactor: implement utp socket * refactor: implement tcp socket * feat: add utp read buffer overflow protection * refactor: remove utp bandwidth workarounds in `tr_peerIo::can_read_wrapper` * build: xcode * code review: copy `tr_port` * code review: remove redundant conditions * code review: adjust PeerBuffer growth factor comment wording * code review: use `std::make_shared` to match return type * code review: remove redundant `socket.reset()` calls * code review: document a pitfall of `tr_peerIo::set_socket` --------- Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
37 lines
1015 B
C++
37 lines
1015 B
C++
// This file Copyright © Mnemosyne LLC.
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
// License text can be found in the licenses/ folder.
|
|
|
|
#ifndef __TRANSMISSION__
|
|
#error only libtransmission should #include this header.
|
|
#endif
|
|
|
|
#ifndef TR_PEER_SOCKET_TCP_H
|
|
#define TR_PEER_SOCKET_TCP_H
|
|
|
|
#include <memory>
|
|
|
|
#include "libtransmission/peer-socket.h"
|
|
|
|
struct tr_session;
|
|
struct tr_socket_address;
|
|
|
|
class tr_peer_socket_tcp : public tr_peer_socket
|
|
{
|
|
public:
|
|
[[nodiscard]] static std::unique_ptr<tr_peer_socket_tcp> create(
|
|
tr_session& session,
|
|
tr_socket_address const& socket_address,
|
|
bool client_is_seed);
|
|
[[nodiscard]] static std::unique_ptr<tr_peer_socket_tcp> create(
|
|
tr_session& session,
|
|
tr_socket_address const& socket_address,
|
|
tr_socket_t sock);
|
|
|
|
protected:
|
|
explicit tr_peer_socket_tcp(tr_socket_address const& socket_address);
|
|
};
|
|
|
|
#endif // TR_PEER_SOCKET_TCP_H
|