Delete AsyncSocketAdapter::Attach, make socket construction time const
Bug: webrtc:6424 Change-Id: I7001c4ac52ddd267dcd55f751f3f38976eab820f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227032 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/master@{#34722}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
a820cc226e
commit
8729d785df
@ -14,6 +14,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "rtc_base/socket.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/third_party/sigslot/sigslot.h"
|
||||
@ -45,13 +47,10 @@ class AsyncSocket : public Socket {
|
||||
|
||||
class AsyncSocketAdapter : public AsyncSocket, public sigslot::has_slots<> {
|
||||
public:
|
||||
// The adapted socket may explicitly be null, and later assigned using Attach.
|
||||
// However, subclasses which support detached mode must override any methods
|
||||
// that will be called during the detached period (usually GetState()), to
|
||||
// avoid dereferencing a null pointer.
|
||||
// Takes ownership of the passed in socket.
|
||||
// TODO(bugs.webrtc.org/6424): Change to unique_ptr here and in callers.
|
||||
explicit AsyncSocketAdapter(AsyncSocket* socket);
|
||||
~AsyncSocketAdapter() override;
|
||||
void Attach(AsyncSocket* socket);
|
||||
|
||||
SocketAddress GetLocalAddress() const override;
|
||||
SocketAddress GetRemoteAddress() const override;
|
||||
int Bind(const SocketAddress& addr) override;
|
||||
@ -78,7 +77,10 @@ class AsyncSocketAdapter : public AsyncSocket, public sigslot::has_slots<> {
|
||||
virtual void OnWriteEvent(AsyncSocket* socket);
|
||||
virtual void OnCloseEvent(AsyncSocket* socket, int err);
|
||||
|
||||
AsyncSocket* socket_;
|
||||
AsyncSocket* GetSocket() const { return socket_.get(); }
|
||||
|
||||
private:
|
||||
const std::unique_ptr<AsyncSocket> socket_;
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
Reference in New Issue
Block a user