blob: 366349db3ad7f5ca9c1d69cf6e0afbf554070a3e [file] [log] [blame]
danilchapbebf54c2016-04-28 01:32:48 -07001/*
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
Steve Anton10542f22019-01-11 09:11:00 -080011#include "rtc_base/null_socket_server.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020012
Markus Handell2cfc1af2022-08-19 08:16:48 +000013#include "api/units/time_delta.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "rtc_base/checks.h"
Markus Handell1d5be492022-08-18 13:49:09 +000015#include "rtc_base/event.h"
Markus Handell2cfc1af2022-08-19 08:16:48 +000016#include "rtc_base/socket_server.h"
danilchapbebf54c2016-04-28 01:32:48 -070017
18namespace rtc {
19
Niels Möllerc572ff32018-11-07 08:43:50 +010020NullSocketServer::NullSocketServer() = default;
danilchapbebf54c2016-04-28 01:32:48 -070021NullSocketServer::~NullSocketServer() {}
22
Markus Handell9a21c492022-08-25 11:40:13 +000023bool NullSocketServer::Wait(webrtc::TimeDelta max_wait_duration,
24 bool process_io) {
Karl Wibergfc47c862019-04-11 10:31:24 +020025 // 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.
Markus Handell9a21c492022-08-25 11:40:13 +000028 event_.Wait(max_wait_duration, /*warn_after=*/Event::kForever);
danilchapbebf54c2016-04-28 01:32:48 -070029 return true;
30}
31
32void NullSocketServer::WakeUp() {
33 event_.Set();
34}
35
danilchapbebf54c2016-04-28 01:32:48 -070036rtc::Socket* NullSocketServer::CreateSocket(int /* family */, int /* type */) {
Artem Titovd3251962021-11-15 16:57:07 +010037 RTC_DCHECK_NOTREACHED();
danilchapbebf54c2016-04-28 01:32:48 -070038 return nullptr;
39}
40
danilchapbebf54c2016-04-28 01:32:48 -070041} // namespace rtc