mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
resetConnectionCallbacks() util function
Summary: In preparation for split callbacks Reviewed By: mjoras, lnicco Differential Revision: D30398849 fbshipit-source-id: 684c289283d0b06b5935fc1b8ab2dcbd126ec0ce
This commit is contained in:
committed by
Facebook GitHub Bot
parent
06ba2e0a41
commit
ee59ae43c6
@@ -141,7 +141,7 @@ const folly::SocketAddress& QuicTransportBase::getLocalAddress() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QuicTransportBase::~QuicTransportBase() {
|
QuicTransportBase::~QuicTransportBase() {
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
|
|
||||||
closeImpl(
|
closeImpl(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
@@ -179,7 +179,7 @@ void QuicTransportBase::close(
|
|||||||
FOLLY_MAYBE_UNUSED auto self = sharedGuard();
|
FOLLY_MAYBE_UNUSED auto self = sharedGuard();
|
||||||
// The caller probably doesn't need a conn callback any more because they
|
// The caller probably doesn't need a conn callback any more because they
|
||||||
// explicitly called close.
|
// explicitly called close.
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
|
|
||||||
// If we were called with no error code, ensure that we are going to write
|
// If we were called with no error code, ensure that we are going to write
|
||||||
// an application close, so the peer knows it didn't come from the transport.
|
// an application close, so the peer knows it didn't come from the transport.
|
||||||
@@ -220,7 +220,7 @@ void QuicTransportBase::closeGracefully() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FOLLY_MAYBE_UNUSED auto self = sharedGuard();
|
FOLLY_MAYBE_UNUSED auto self = sharedGuard();
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
closeState_ = CloseState::GRACEFUL_CLOSING;
|
closeState_ = CloseState::GRACEFUL_CLOSING;
|
||||||
updatePacingOnClose(*conn_);
|
updatePacingOnClose(*conn_);
|
||||||
if (conn_->qLogger) {
|
if (conn_->qLogger) {
|
||||||
@@ -420,7 +420,7 @@ void QuicTransportBase::closeImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// can't invoke connection callbacks any more.
|
// can't invoke connection callbacks any more.
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
|
|
||||||
// Don't need outstanding packets.
|
// Don't need outstanding packets.
|
||||||
conn_->outstandings.packets.clear();
|
conn_->outstandings.packets.clear();
|
||||||
|
@@ -809,6 +809,10 @@ class QuicTransportBase : public QuicSocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetConnectionCallbacks() {
|
||||||
|
connCallback_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::atomic<folly::EventBase*> evb_;
|
std::atomic<folly::EventBase*> evb_;
|
||||||
std::unique_ptr<folly::AsyncUDPSocket> socket_;
|
std::unique_ptr<folly::AsyncUDPSocket> socket_;
|
||||||
ConnectionCallback* connCallback_{nullptr};
|
ConnectionCallback* connCallback_{nullptr};
|
||||||
|
@@ -210,7 +210,7 @@ class TestQuicTransport
|
|||||||
}
|
}
|
||||||
|
|
||||||
~TestQuicTransport() override {
|
~TestQuicTransport() override {
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
// we need to call close in the derived class.
|
// we need to call close in the derived class.
|
||||||
closeImpl(
|
closeImpl(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
|
@@ -36,7 +36,7 @@ class TestQuicTransport
|
|||||||
|
|
||||||
~TestQuicTransport() override {
|
~TestQuicTransport() override {
|
||||||
// we need to call close in the derived class.
|
// we need to call close in the derived class.
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
closeImpl(
|
closeImpl(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
QuicErrorCode(LocalErrorCode::SHUTTING_DOWN),
|
QuicErrorCode(LocalErrorCode::SHUTTING_DOWN),
|
||||||
|
@@ -91,7 +91,7 @@ QuicClientTransport::~QuicClientTransport() {
|
|||||||
VLOG(10) << "Destroyed connection to server=" << conn_->peerAddress;
|
VLOG(10) << "Destroyed connection to server=" << conn_->peerAddress;
|
||||||
// The caller probably doesn't need the conn callback after destroying the
|
// The caller probably doesn't need the conn callback after destroying the
|
||||||
// transport.
|
// transport.
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
// Close without draining.
|
// Close without draining.
|
||||||
closeImpl(
|
closeImpl(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
|
@@ -62,7 +62,7 @@ QuicServerTransport::~QuicServerTransport() {
|
|||||||
VLOG(10) << "Destroyed connection to client=" << *this;
|
VLOG(10) << "Destroyed connection to client=" << *this;
|
||||||
// The caller probably doesn't need the conn callback after destroying the
|
// The caller probably doesn't need the conn callback after destroying the
|
||||||
// transport.
|
// transport.
|
||||||
connCallback_ = nullptr;
|
resetConnectionCallbacks();
|
||||||
closeImpl(
|
closeImpl(
|
||||||
std::make_pair(
|
std::make_pair(
|
||||||
QuicErrorCode(LocalErrorCode::SHUTTING_DOWN),
|
QuicErrorCode(LocalErrorCode::SHUTTING_DOWN),
|
||||||
|
Reference in New Issue
Block a user