Revert "Take out listen support from AsyncPacketSocket"
This reverts commit b141c162ee2ef88a7498ba8cb8bc852287f93ad2. Reason for revert: Breaking WebRTC rolls. See https://ci.chromium.org/ui/b/8832847811929676465 for an example failed build. Original change's description: > Take out listen support from AsyncPacketSocket > > Moved to new interface class AsyncListenSocket. > > Bug: webrtc:13065 > Change-Id: Ib96ce154ba19979360ecd8144981d947ff5b8b18 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232607 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Reviewed-by: Harald Alvestrand <hta@webrtc.org> > Commit-Queue: Niels Moller <nisse@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#35234} # Not skipping CQ checks because original CL landed > 1 day ago. Bug: webrtc:13065 Change-Id: Id5d5b35cb21704ca4e3006caf1636906df062609 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235824 Reviewed-by: Evan Shrubsole <eshr@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Tommi <tommi@webrtc.org> Commit-Queue: Evan Shrubsole <eshr@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35249}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
b4d4ae2c23
commit
1f30c2ba9b
@ -28,7 +28,7 @@ namespace rtc {
|
||||
// buffer them in user space.
|
||||
class AsyncTCPSocketBase : public AsyncPacketSocket {
|
||||
public:
|
||||
AsyncTCPSocketBase(Socket* socket, size_t max_packet_size);
|
||||
AsyncTCPSocketBase(Socket* socket, bool listen, size_t max_packet_size);
|
||||
~AsyncTCPSocketBase() override;
|
||||
|
||||
// Pure virtual methods to send and recv data.
|
||||
@ -36,6 +36,8 @@ class AsyncTCPSocketBase : public AsyncPacketSocket {
|
||||
size_t cb,
|
||||
const rtc::PacketOptions& options) override = 0;
|
||||
virtual void ProcessInput(char* data, size_t* len) = 0;
|
||||
// Signals incoming connection.
|
||||
virtual void HandleIncomingConnection(Socket* socket) = 0;
|
||||
|
||||
SocketAddress GetLocalAddress() const override;
|
||||
SocketAddress GetRemoteAddress() const override;
|
||||
@ -74,6 +76,7 @@ class AsyncTCPSocketBase : public AsyncPacketSocket {
|
||||
void OnCloseEvent(Socket* socket, int error);
|
||||
|
||||
std::unique_ptr<Socket> socket_;
|
||||
bool listen_;
|
||||
Buffer inbuf_;
|
||||
Buffer outbuf_;
|
||||
size_t max_insize_;
|
||||
@ -90,37 +93,19 @@ class AsyncTCPSocket : public AsyncTCPSocketBase {
|
||||
static AsyncTCPSocket* Create(Socket* socket,
|
||||
const SocketAddress& bind_address,
|
||||
const SocketAddress& remote_address);
|
||||
explicit AsyncTCPSocket(Socket* socket);
|
||||
AsyncTCPSocket(Socket* socket, bool listen);
|
||||
~AsyncTCPSocket() override {}
|
||||
|
||||
int Send(const void* pv,
|
||||
size_t cb,
|
||||
const rtc::PacketOptions& options) override;
|
||||
void ProcessInput(char* data, size_t* len) override;
|
||||
void HandleIncomingConnection(Socket* socket) override;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(AsyncTCPSocket);
|
||||
};
|
||||
|
||||
class AsyncTcpListenSocket : public AsyncListenSocket {
|
||||
public:
|
||||
explicit AsyncTcpListenSocket(std::unique_ptr<Socket> socket);
|
||||
|
||||
State GetState() const override;
|
||||
SocketAddress GetLocalAddress() const override;
|
||||
|
||||
int GetOption(Socket::Option opt, int* value) override;
|
||||
int SetOption(Socket::Option opt, int value) override;
|
||||
|
||||
virtual void HandleIncomingConnection(rtc::Socket* socket);
|
||||
|
||||
private:
|
||||
// Called by the underlying socket
|
||||
void OnReadEvent(Socket* socket);
|
||||
|
||||
std::unique_ptr<Socket> socket_;
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // RTC_BASE_ASYNC_TCP_SOCKET_H_
|
||||
|
||||
Reference in New Issue
Block a user