mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-04-18 17:24:03 +03:00
Reviewed By: lnicco Differential Revision: D33587012 fbshipit-source-id: 972eb440f0156c9c04aa6e8787561b18295c1a97
47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <quic/api/QuicStreamAsyncTransport.h>
|
|
#include <quic/client/QuicClientTransport.h>
|
|
|
|
namespace quic {
|
|
|
|
/**
|
|
* Adaptor from QuicClientTransport to folly::AsyncTransport,
|
|
* for experiments with QUIC in code using folly::AsyncSockets.
|
|
*/
|
|
class QuicClientAsyncTransport : public QuicStreamAsyncTransport,
|
|
public QuicSocket::ConnectionCallback {
|
|
public:
|
|
using UniquePtr = std::unique_ptr<
|
|
QuicClientAsyncTransport,
|
|
folly::DelayedDestruction::Destructor>;
|
|
explicit QuicClientAsyncTransport(
|
|
const std::shared_ptr<QuicClientTransport>& clientSock);
|
|
|
|
protected:
|
|
~QuicClientAsyncTransport() override = default;
|
|
|
|
//
|
|
// QuicSocket::ConnectionCallback
|
|
//
|
|
void onNewBidirectionalStream(StreamId id) noexcept override;
|
|
void onNewUnidirectionalStream(StreamId id) noexcept override;
|
|
void onStopSending(StreamId id, ApplicationErrorCode error) noexcept override;
|
|
void onConnectionEnd() noexcept override;
|
|
void onConnectionSetupError(
|
|
std::pair<QuicErrorCode, std::string> code) noexcept override {
|
|
onConnectionError(std::move(code));
|
|
}
|
|
void onConnectionError(
|
|
std::pair<QuicErrorCode, std::string> code) noexcept override;
|
|
void onTransportReady() noexcept override;
|
|
};
|
|
} // namespace quic
|