Delete AsyncSocket class, merge into Socket class
Bug: webrtc:13065
Change-Id: I13afee2386ea9c4de0e4fa95133f0c4d3ec826e8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227031
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34787}
diff --git a/rtc_base/socket.h b/rtc_base/socket.h
index 81f4f0b..e38f8af 100644
--- a/rtc_base/socket.h
+++ b/rtc_base/socket.h
@@ -25,8 +25,10 @@
#include "rtc_base/win32.h"
#endif
+#include "absl/base/attributes.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/socket_address.h"
+#include "rtc_base/third_party/sigslot/sigslot.h"
// Rather than converting errors into a private namespace,
// Reuse the POSIX socket api errors. Note this depends on
@@ -124,6 +126,17 @@
virtual int GetOption(Option opt, int* value) = 0;
virtual int SetOption(Option opt, int value) = 0;
+ // SignalReadEvent and SignalWriteEvent use multi_threaded_local to allow
+ // access concurrently from different thread.
+ // For example SignalReadEvent::connect will be called in AsyncUDPSocket ctor
+ // but at the same time the SocketDispatcher may be signaling the read event.
+ // ready to read
+ sigslot::signal1<Socket*, sigslot::multi_threaded_local> SignalReadEvent;
+ // ready to write
+ sigslot::signal1<Socket*, sigslot::multi_threaded_local> SignalWriteEvent;
+ sigslot::signal1<Socket*> SignalConnectEvent; // connected
+ sigslot::signal2<Socket*, int> SignalCloseEvent; // closed
+
protected:
Socket() {}
@@ -131,6 +144,10 @@
RTC_DISALLOW_COPY_AND_ASSIGN(Socket);
};
+// TODO(bugs.webrtc.org/13065): Old alias, delete ASAP, when downstream code is
+// updated.
+using AsyncSocket ABSL_DEPRECATED("bugs.webrtc.org/13065") = Socket;
+
} // namespace rtc
#endif // RTC_BASE_SOCKET_H_