xref: /aosp_15_r20/external/webrtc/rtc_base/null_socket_server.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2016 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "rtc_base/null_socket_server.h"
12 
13 #include "api/units/time_delta.h"
14 #include "rtc_base/checks.h"
15 #include "rtc_base/event.h"
16 #include "rtc_base/socket_server.h"
17 
18 namespace rtc {
19 
20 NullSocketServer::NullSocketServer() = default;
~NullSocketServer()21 NullSocketServer::~NullSocketServer() {}
22 
Wait(webrtc::TimeDelta max_wait_duration,bool process_io)23 bool NullSocketServer::Wait(webrtc::TimeDelta max_wait_duration,
24                             bool process_io) {
25   // Wait with the given timeout. Do not log a warning if we end up waiting for
26   // a long time; that just means no one has any work for us, which is perfectly
27   // legitimate.
28   event_.Wait(max_wait_duration, /*warn_after=*/Event::kForever);
29   return true;
30 }
31 
WakeUp()32 void NullSocketServer::WakeUp() {
33   event_.Set();
34 }
35 
CreateSocket(int,int)36 rtc::Socket* NullSocketServer::CreateSocket(int /* family */, int /* type */) {
37   RTC_DCHECK_NOTREACHED();
38   return nullptr;
39 }
40 
41 }  // namespace rtc
42