xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/qbone/bonnet/qbone_tunnel_silo.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "quiche/quic/qbone/bonnet/qbone_tunnel_silo.h"
6 
7 namespace quic {
8 
Run()9 void QboneTunnelSilo::Run() {
10   while (ShouldRun()) {
11     tunnel_->WaitForEvents();
12   }
13 
14   QUIC_LOG(INFO) << "Tunnel has disconnected in state: "
15                  << tunnel_->StateToString(tunnel_->Disconnect());
16 }
17 
Quit()18 void QboneTunnelSilo::Quit() {
19   QUIC_LOG(INFO) << "Quit called on QboneTunnelSilo";
20   quitting_.Notify();
21   tunnel_->Wake();
22 }
23 
ShouldRun()24 bool QboneTunnelSilo::ShouldRun() {
25   bool post_init_shutdown_ready =
26       only_setup_tun_ &&
27       tunnel_->state() == quic::QboneTunnelInterface::STARTED;
28   return !quitting_.HasBeenNotified() && !post_init_shutdown_ready;
29 }
30 
31 }  // namespace quic
32