Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 2 | /* |
Junxiao Shi | b98aa3a | 2022-01-12 01:14:08 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2022, Regents of the University of California, |
Junxiao Shi | 1e46be3 | 2015-01-08 20:18:05 -0700 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Junxiao Shi | a1937bf | 2014-11-06 11:43:40 -0700 | [diff] [blame] | 24 | */ |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 25 | |
| 26 | #include "tcp-channel.hpp" |
Davide Pesavento | cb425e8 | 2019-07-14 21:48:22 -0400 | [diff] [blame] | 27 | #include "face.hpp" |
Yukai Tu | 16aabbc | 2015-10-06 05:08:42 -0700 | [diff] [blame] | 28 | #include "generic-link-service.hpp" |
| 29 | #include "tcp-transport.hpp" |
Davide Pesavento | 2cae8ca | 2019-04-18 20:48:05 -0400 | [diff] [blame] | 30 | #include "common/global.hpp" |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 31 | |
Davide Pesavento | a9b09b6 | 2022-06-04 14:07:25 -0400 | [diff] [blame] | 32 | #include <boost/asio/ip/v6_only.hpp> |
| 33 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 34 | namespace nfd::face { |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 35 | |
Davide Pesavento | a314808 | 2018-04-12 18:21:54 -0400 | [diff] [blame] | 36 | NFD_LOG_INIT(TcpChannel); |
Alexander Afanasyev | 3958b01 | 2014-01-31 15:06:13 -0800 | [diff] [blame] | 37 | |
Yukai Tu | 16aabbc | 2015-10-06 05:08:42 -0700 | [diff] [blame] | 38 | namespace ip = boost::asio::ip; |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 39 | |
Alexander Afanasyev | ded1742 | 2018-04-03 19:00:23 -0400 | [diff] [blame] | 40 | TcpChannel::TcpChannel(const tcp::Endpoint& localEndpoint, bool wantCongestionMarking, |
| 41 | DetermineFaceScopeFromAddress determineFaceScope) |
Davide Pesavento | 292e5e1 | 2015-03-13 02:08:33 +0100 | [diff] [blame] | 42 | : m_localEndpoint(localEndpoint) |
| 43 | , m_acceptor(getGlobalIoService()) |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 44 | , m_socket(getGlobalIoService()) |
Eric Newberry | 0c84164 | 2018-01-17 15:01:00 -0700 | [diff] [blame] | 45 | , m_wantCongestionMarking(wantCongestionMarking) |
Alexander Afanasyev | ded1742 | 2018-04-03 19:00:23 -0400 | [diff] [blame] | 46 | , m_determineFaceScope(std::move(determineFaceScope)) |
Junxiao Shi | 61e3cc5 | 2014-03-03 20:40:28 -0700 | [diff] [blame] | 47 | { |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 48 | setUri(FaceUri(m_localEndpoint)); |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 49 | NFD_LOG_CHAN_INFO("Creating channel"); |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | void |
Alexander Afanasyev | 855a53c | 2014-01-27 12:03:00 -0800 | [diff] [blame] | 53 | TcpChannel::listen(const FaceCreatedCallback& onFaceCreated, |
Davide Pesavento | 47ab029 | 2015-11-02 18:45:39 +0100 | [diff] [blame] | 54 | const FaceCreationFailedCallback& onAcceptFailed, |
Alexander Afanasyev | 855a53c | 2014-01-27 12:03:00 -0800 | [diff] [blame] | 55 | int backlog/* = tcp::acceptor::max_connections*/) |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 56 | { |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 57 | if (isListening()) { |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 58 | NFD_LOG_CHAN_WARN("Already listening"); |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 59 | return; |
| 60 | } |
| 61 | |
| 62 | m_acceptor.open(m_localEndpoint.protocol()); |
| 63 | m_acceptor.set_option(ip::tcp::acceptor::reuse_address(true)); |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 64 | if (m_localEndpoint.address().is_v6()) { |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 65 | m_acceptor.set_option(ip::v6_only(true)); |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 66 | } |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 67 | m_acceptor.bind(m_localEndpoint); |
| 68 | m_acceptor.listen(backlog); |
Alexander Afanasyev | 53a6fd3 | 2014-03-23 00:00:04 -0700 | [diff] [blame] | 69 | |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 70 | accept(onFaceCreated, onAcceptFailed); |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 71 | NFD_LOG_CHAN_DEBUG("Started listening"); |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | void |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 75 | TcpChannel::connect(const tcp::Endpoint& remoteEndpoint, |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 76 | const FaceParams& params, |
Davide Pesavento | 47ab029 | 2015-11-02 18:45:39 +0100 | [diff] [blame] | 77 | const FaceCreatedCallback& onFaceCreated, |
| 78 | const FaceCreationFailedCallback& onConnectFailed, |
Davide Pesavento | c19408d | 2017-04-08 00:42:55 -0400 | [diff] [blame] | 79 | time::nanoseconds timeout) |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 80 | { |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 81 | auto it = m_channelFaces.find(remoteEndpoint); |
| 82 | if (it != m_channelFaces.end()) { |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 83 | NFD_LOG_CHAN_TRACE("Reusing existing face for " << remoteEndpoint); |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 84 | onFaceCreated(it->second); |
Alexander Afanasyev | 334b714 | 2014-01-28 12:59:39 -0800 | [diff] [blame] | 85 | return; |
| 86 | } |
| 87 | |
Alexander Afanasyev | a6bd7da | 2019-04-25 17:26:11 -0400 | [diff] [blame] | 88 | auto clientSocket = make_shared<ip::tcp::socket>(getGlobalIoService()); |
Davide Pesavento | 3dade00 | 2019-03-19 11:29:56 -0600 | [diff] [blame] | 89 | auto timeoutEvent = getScheduler().schedule(timeout, [=] { |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 90 | handleConnectTimeout(remoteEndpoint, clientSocket, onConnectFailed); |
| 91 | }); |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 92 | |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 93 | NFD_LOG_CHAN_TRACE("Connecting to " << remoteEndpoint); |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 94 | clientSocket->async_connect(remoteEndpoint, [=] (const auto& e) { |
| 95 | this->handleConnect(e, remoteEndpoint, clientSocket, params, timeoutEvent, onFaceCreated, onConnectFailed); |
| 96 | }); |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 97 | } |
| 98 | |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 99 | void |
Yukai Tu | 16aabbc | 2015-10-06 05:08:42 -0700 | [diff] [blame] | 100 | TcpChannel::createFace(ip::tcp::socket&& socket, |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 101 | const FaceParams& params, |
Junxiao Shi | b98aa3a | 2022-01-12 01:14:08 +0000 | [diff] [blame] | 102 | const FaceCreatedCallback& onFaceCreated, |
| 103 | const FaceCreationFailedCallback& onFaceCreationFailed) |
Alexander Afanasyev | a16abd2 | 2014-01-31 18:12:29 -0800 | [diff] [blame] | 104 | { |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 105 | shared_ptr<Face> face; |
Junxiao Shi | b98aa3a | 2022-01-12 01:14:08 +0000 | [diff] [blame] | 106 | boost::system::error_code ec; |
| 107 | tcp::Endpoint remoteEndpoint = socket.remote_endpoint(ec); |
| 108 | if (ec) { |
| 109 | NFD_LOG_CHAN_DEBUG("Retrieve socket remote endpoint failed: " << ec.message()); |
| 110 | if (onFaceCreationFailed) { |
| 111 | onFaceCreationFailed(500, "Retrieve socket remote endpoint failed: " + ec.message()); |
| 112 | } |
| 113 | return; |
| 114 | } |
Steve DiBenedetto | 2aa4eca | 2014-06-20 10:47:40 -0600 | [diff] [blame] | 115 | |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 116 | auto it = m_channelFaces.find(remoteEndpoint); |
Davide Pesavento | 292e5e1 | 2015-03-13 02:08:33 +0100 | [diff] [blame] | 117 | if (it == m_channelFaces.end()) { |
Eric Newberry | 2642cd2 | 2017-07-13 21:34:53 -0400 | [diff] [blame] | 118 | GenericLinkService::Options options; |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 119 | options.allowLocalFields = params.wantLocalFields; |
| 120 | options.reliabilityOptions.isEnabled = params.wantLpReliability; |
Eric Newberry | f40551a | 2016-09-05 15:41:16 -0700 | [diff] [blame] | 121 | |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 122 | if (boost::logic::indeterminate(params.wantCongestionMarking)) { |
| 123 | // Use default value for this channel if parameter is indeterminate |
| 124 | options.allowCongestionMarking = m_wantCongestionMarking; |
| 125 | } |
| 126 | else { |
Davide Pesavento | fa2aa50 | 2019-03-22 13:30:02 -0400 | [diff] [blame] | 127 | options.allowCongestionMarking = bool(params.wantCongestionMarking); |
Eric Newberry | 0c3e57b | 2018-01-25 20:54:46 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | if (params.baseCongestionMarkingInterval) { |
| 131 | options.baseCongestionMarkingInterval = *params.baseCongestionMarkingInterval; |
| 132 | } |
| 133 | if (params.defaultCongestionThreshold) { |
| 134 | options.defaultCongestionThreshold = *params.defaultCongestionThreshold; |
| 135 | } |
| 136 | |
| 137 | auto linkService = make_unique<GenericLinkService>(options); |
Alexander Afanasyev | ded1742 | 2018-04-03 19:00:23 -0400 | [diff] [blame] | 138 | auto faceScope = m_determineFaceScope(socket.local_endpoint().address(), |
| 139 | socket.remote_endpoint().address()); |
| 140 | auto transport = make_unique<TcpTransport>(std::move(socket), params.persistency, faceScope); |
Junxiao Shi | cde37ad | 2015-12-24 01:02:05 -0700 | [diff] [blame] | 141 | face = make_shared<Face>(std::move(linkService), std::move(transport)); |
Davide Pesavento | b7bfcb9 | 2022-05-22 23:55:23 -0400 | [diff] [blame] | 142 | face->setChannel(weak_from_this()); |
Steve DiBenedetto | 2aa4eca | 2014-06-20 10:47:40 -0600 | [diff] [blame] | 143 | |
Davide Pesavento | 292e5e1 | 2015-03-13 02:08:33 +0100 | [diff] [blame] | 144 | m_channelFaces[remoteEndpoint] = face; |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 145 | connectFaceClosedSignal(*face, [this, remoteEndpoint] { m_channelFaces.erase(remoteEndpoint); }); |
Davide Pesavento | 292e5e1 | 2015-03-13 02:08:33 +0100 | [diff] [blame] | 146 | } |
| 147 | else { |
| 148 | // we already have a face for this endpoint, just reuse it |
| 149 | face = it->second; |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 150 | NFD_LOG_CHAN_TRACE("Reusing existing face for " << remoteEndpoint); |
Junxiao Shi | 61e3cc5 | 2014-03-03 20:40:28 -0700 | [diff] [blame] | 151 | |
Davide Pesavento | 292e5e1 | 2015-03-13 02:08:33 +0100 | [diff] [blame] | 152 | boost::system::error_code error; |
| 153 | socket.shutdown(ip::tcp::socket::shutdown_both, error); |
| 154 | socket.close(error); |
| 155 | } |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 156 | |
Steve DiBenedetto | 2aa4eca | 2014-06-20 10:47:40 -0600 | [diff] [blame] | 157 | // Need to invoke the callback regardless of whether or not we have already created |
| 158 | // the face so that control responses and such can be sent. |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 159 | onFaceCreated(face); |
Alexander Afanasyev | a16abd2 | 2014-01-31 18:12:29 -0800 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | void |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 163 | TcpChannel::accept(const FaceCreatedCallback& onFaceCreated, |
Davide Pesavento | 47ab029 | 2015-11-02 18:45:39 +0100 | [diff] [blame] | 164 | const FaceCreationFailedCallback& onAcceptFailed) |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 165 | { |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 166 | m_acceptor.async_accept(m_socket, [=] (const auto& e) { this->handleAccept(e, onFaceCreated, onAcceptFailed); }); |
Alexander Afanasyev | a0a10fb | 2014-02-13 19:56:15 -0800 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | void |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 170 | TcpChannel::handleAccept(const boost::system::error_code& error, |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 171 | const FaceCreatedCallback& onFaceCreated, |
Davide Pesavento | 47ab029 | 2015-11-02 18:45:39 +0100 | [diff] [blame] | 172 | const FaceCreationFailedCallback& onAcceptFailed) |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 173 | { |
| 174 | if (error) { |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 175 | if (error != boost::asio::error::operation_aborted) { |
| 176 | NFD_LOG_CHAN_DEBUG("Accept failed: " << error.message()); |
| 177 | if (onAcceptFailed) |
| 178 | onAcceptFailed(500, "Accept failed: " + error.message()); |
| 179 | } |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 180 | return; |
| 181 | } |
| 182 | |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 183 | NFD_LOG_CHAN_TRACE("Incoming connection from " << m_socket.remote_endpoint()); |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 184 | |
| 185 | FaceParams params; |
| 186 | params.persistency = ndn::nfd::FACE_PERSISTENCY_ON_DEMAND; |
Junxiao Shi | b98aa3a | 2022-01-12 01:14:08 +0000 | [diff] [blame] | 187 | createFace(std::move(m_socket), params, onFaceCreated, onAcceptFailed); |
Alexander Afanasyev | 334b714 | 2014-01-28 12:59:39 -0800 | [diff] [blame] | 188 | |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 189 | // prepare accepting the next connection |
| 190 | accept(onFaceCreated, onAcceptFailed); |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | void |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 194 | TcpChannel::handleConnect(const boost::system::error_code& error, |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 195 | const tcp::Endpoint& remoteEndpoint, |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 196 | const shared_ptr<ip::tcp::socket>& socket, |
Davide Pesavento | 15b5505 | 2018-01-27 19:09:28 -0500 | [diff] [blame] | 197 | const FaceParams& params, |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 198 | const scheduler::EventId& connectTimeoutEvent, |
| 199 | const FaceCreatedCallback& onFaceCreated, |
Davide Pesavento | 47ab029 | 2015-11-02 18:45:39 +0100 | [diff] [blame] | 200 | const FaceCreationFailedCallback& onConnectFailed) |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 201 | { |
Davide Pesavento | 3dade00 | 2019-03-19 11:29:56 -0600 | [diff] [blame] | 202 | connectTimeoutEvent.cancel(); |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 203 | |
| 204 | if (error) { |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 205 | if (error != boost::asio::error::operation_aborted) { |
| 206 | NFD_LOG_CHAN_DEBUG("Connection to " << remoteEndpoint << " failed: " << error.message()); |
| 207 | if (onConnectFailed) |
| 208 | onConnectFailed(504, "Connection failed: " + error.message()); |
| 209 | } |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 210 | return; |
| 211 | } |
| 212 | |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 213 | NFD_LOG_CHAN_TRACE("Connected to " << socket->remote_endpoint()); |
Junxiao Shi | b98aa3a | 2022-01-12 01:14:08 +0000 | [diff] [blame] | 214 | createFace(std::move(*socket), params, onFaceCreated, onConnectFailed); |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | void |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 218 | TcpChannel::handleConnectTimeout(const tcp::Endpoint& remoteEndpoint, |
| 219 | const shared_ptr<ip::tcp::socket>& socket, |
Davide Pesavento | 47ab029 | 2015-11-02 18:45:39 +0100 | [diff] [blame] | 220 | const FaceCreationFailedCallback& onConnectFailed) |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 221 | { |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 222 | NFD_LOG_CHAN_DEBUG("Connection to " << remoteEndpoint << " timed out"); |
Davide Pesavento | 6ad890a | 2015-03-09 03:43:17 +0100 | [diff] [blame] | 223 | |
| 224 | // abort the connection attempt |
| 225 | boost::system::error_code error; |
| 226 | socket->close(error); |
| 227 | |
| 228 | if (onConnectFailed) |
Davide Pesavento | 77911cc | 2017-04-08 22:12:30 -0400 | [diff] [blame] | 229 | onConnectFailed(504, "Connection timed out"); |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 230 | } |
| 231 | |
Davide Pesavento | e422f9e | 2022-06-03 01:30:23 -0400 | [diff] [blame] | 232 | } // namespace nfd::face |