blob: 32a6215e3131c9322751e572dd03b3c762feb94d [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020013#include "rtc_base/checks.h"
Markus Handell1d5be492022-08-18 13:49:09 +000014#include "rtc_base/event.h"
danilchapbebf54c2016-04-28 01:32:48 -070015
16namespace rtc {
17
Niels Möllerc572ff32018-11-07 08:43:50 +010018NullSocketServer::NullSocketServer() = default;
danilchapbebf54c2016-04-28 01:32:48 -070019NullSocketServer::~NullSocketServer() {}
20
21bool NullSocketServer::Wait(int cms, bool process_io) {
Karl Wibergfc47c862019-04-11 10:31:24 +020022 // Wait with the given timeout. Do not log a warning if we end up waiting for
23 // a long time; that just means no one has any work for us, which is perfectly
24 // legitimate.
Markus Handell1d5be492022-08-18 13:49:09 +000025 event_.Wait(/*give_up_after=*/cms == kForever
26 ? Event::kForever
27 : webrtc::TimeDelta::Millis(cms),
28 /*warn_after_ms=*/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