blob: 4f9e01d88916848d631b6ad5a71811b62838c8a4 [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
23bool NullSocketServer::Wait(int cms, bool process_io) {
Karl Wibergfc47c862019-04-11 10:31:24 +020024 // Wait with the given timeout. Do not log a warning if we end up waiting for
25 // a long time; that just means no one has any work for us, which is perfectly
26 // legitimate.
Markus Handell1d5be492022-08-18 13:49:09 +000027 event_.Wait(/*give_up_after=*/cms == kForever
28 ? Event::kForever
29 : webrtc::TimeDelta::Millis(cms),
Markus Handell2cfc1af2022-08-19 08:16:48 +000030 /*warn_after=*/Event::kForever);
danilchapbebf54c2016-04-28 01:32:48 -070031 return true;
32}
33
34void NullSocketServer::WakeUp() {
35 event_.Set();
36}
37
danilchapbebf54c2016-04-28 01:32:48 -070038rtc::Socket* NullSocketServer::CreateSocket(int /* family */, int /* type */) {
Artem Titovd3251962021-11-15 16:57:07 +010039 RTC_DCHECK_NOTREACHED();
danilchapbebf54c2016-04-28 01:32:48 -070040 return nullptr;
41}
42
danilchapbebf54c2016-04-28 01:32:48 -070043} // namespace rtc