Mark construction time members of PhysicalSocketServer as const

Bug: webrtc:11567
Change-Id: I06d48aa1636ce1dc684e6a1f6332366be9df22d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/175007
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31242}
This commit is contained in:
Niels Möller
2020-05-13 14:42:22 +02:00
committed by Commit Bot
parent a98cea863d
commit 611fba4517
2 changed files with 16 additions and 12 deletions

View File

@ -1205,22 +1205,26 @@ class Signaler : public EventDispatcher {
bool* pf_; bool* pf_;
}; };
PhysicalSocketServer::PhysicalSocketServer() : fWait_(false) { PhysicalSocketServer::PhysicalSocketServer()
:
#if defined(WEBRTC_USE_EPOLL)
// Since Linux 2.6.8, the size argument is ignored, but must be greater
// than zero. Before that the size served as hint to the kernel for the
// amount of space to initially allocate in internal data structures.
epoll_fd_(epoll_create(FD_SETSIZE)),
#endif
#if defined(WEBRTC_WIN)
socket_ev_(WSACreateEvent()),
#endif
fWait_(false) {
#if defined(WEBRTC_USE_EPOLL) #if defined(WEBRTC_USE_EPOLL)
// Since Linux 2.6.8, the size argument is ignored, but must be greater than
// zero. Before that the size served as hint to the kernel for the amount of
// space to initially allocate in internal data structures.
epoll_fd_ = epoll_create(FD_SETSIZE);
if (epoll_fd_ == -1) { if (epoll_fd_ == -1) {
// Not an error, will fall back to "select" below. // Not an error, will fall back to "select" below.
RTC_LOG_E(LS_WARNING, EN, errno) << "epoll_create"; RTC_LOG_E(LS_WARNING, EN, errno) << "epoll_create";
epoll_fd_ = INVALID_SOCKET; // Note that -1 == INVALID_SOCKET, the alias used by later checks.
} }
#endif #endif
signal_wakeup_ = new Signaler(this, &fWait_); signal_wakeup_ = new Signaler(this, &fWait_);
#if defined(WEBRTC_WIN)
socket_ev_ = WSACreateEvent();
#endif
} }
PhysicalSocketServer::~PhysicalSocketServer() { PhysicalSocketServer::~PhysicalSocketServer() {

View File

@ -117,7 +117,7 @@ class RTC_EXPORT PhysicalSocketServer : public SocketServer {
bool WaitEpoll(int cms); bool WaitEpoll(int cms);
bool WaitPoll(int cms, Dispatcher* dispatcher); bool WaitPoll(int cms, Dispatcher* dispatcher);
int epoll_fd_ = INVALID_SOCKET; const int epoll_fd_ = INVALID_SOCKET;
std::vector<struct epoll_event> epoll_events_; std::vector<struct epoll_event> epoll_events_;
#endif // WEBRTC_USE_EPOLL #endif // WEBRTC_USE_EPOLL
DispatcherSet dispatchers_; DispatcherSet dispatchers_;
@ -126,10 +126,10 @@ class RTC_EXPORT PhysicalSocketServer : public SocketServer {
bool processing_dispatchers_ = false; bool processing_dispatchers_ = false;
Signaler* signal_wakeup_; Signaler* signal_wakeup_;
CriticalSection crit_; CriticalSection crit_;
bool fWait_;
#if defined(WEBRTC_WIN) #if defined(WEBRTC_WIN)
WSAEVENT socket_ev_; const WSAEVENT socket_ev_;
#endif #endif
bool fWait_;
}; };
class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> { class PhysicalSocket : public AsyncSocket, public sigslot::has_slots<> {