|
| 1 | +/* |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * This source code is licensed under the BSD-style license found in the |
| 6 | + * LICENSE file in the root directory of this source tree. |
| 7 | + */ |
| 8 | + |
| 9 | +#include <proxygen/lib/transport/qmux/FollyQmuxTransport.h> |
| 10 | + |
| 11 | +#include <folly/io/coro/Transport.h> |
| 12 | + |
| 13 | +namespace proxygen::qmux { |
| 14 | + |
| 15 | +FollyQmuxTransport::FollyQmuxTransport( |
| 16 | + std::unique_ptr<folly::coro::TransportIf> transport) |
| 17 | + : transport_(std::move(transport)) { |
| 18 | +} |
| 19 | + |
| 20 | +FollyQmuxTransport::~FollyQmuxTransport() = default; |
| 21 | + |
| 22 | +folly::coro::Task<size_t> FollyQmuxTransport::read( |
| 23 | + folly::IOBufQueue& readBuf, |
| 24 | + size_t minReadSize, |
| 25 | + size_t newAllocationSize, |
| 26 | + std::chrono::milliseconds timeout) { |
| 27 | + return transport_->read(readBuf, minReadSize, newAllocationSize, timeout); |
| 28 | +} |
| 29 | + |
| 30 | +folly::coro::Task<folly::Unit> FollyQmuxTransport::write( |
| 31 | + folly::IOBufQueue& writeBuf, std::chrono::milliseconds timeout) { |
| 32 | + return transport_->write(writeBuf, timeout); |
| 33 | +} |
| 34 | + |
| 35 | +void FollyQmuxTransport::shutdownWrite() { |
| 36 | + transport_->shutdownWrite(); |
| 37 | +} |
| 38 | + |
| 39 | +folly::SocketAddress FollyQmuxTransport::getLocalAddress() const noexcept { |
| 40 | + return transport_->getLocalAddress(); |
| 41 | +} |
| 42 | + |
| 43 | +folly::SocketAddress FollyQmuxTransport::getPeerAddress() const noexcept { |
| 44 | + return transport_->getPeerAddress(); |
| 45 | +} |
| 46 | + |
| 47 | +folly::AsyncTransport* FollyQmuxTransport::getUnderlyingTransport() |
| 48 | + const noexcept { |
| 49 | + return transport_->getTransport(); |
| 50 | +} |
| 51 | + |
| 52 | +} // namespace proxygen::qmux |
0 commit comments