diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /netwerk/protocol/http/PendingTransactionInfo.h | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | netwerk/protocol/http/PendingTransactionInfo.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/netwerk/protocol/http/PendingTransactionInfo.h b/netwerk/protocol/http/PendingTransactionInfo.h new file mode 100644 index 0000000000..73f3a16089 --- /dev/null +++ b/netwerk/protocol/http/PendingTransactionInfo.h @@ -0,0 +1,60 @@ +/* vim:t ts=4 sw=2 sts=2 et cin: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef PendingTransactionInfo_h__ +#define PendingTransactionInfo_h__ + +#include "HalfOpenSocket.h" + +namespace mozilla { +namespace net { + +class PendingTransactionInfo final : public ARefBase { + public: + explicit PendingTransactionInfo(nsHttpTransaction* trans) + : mTransaction(trans) {} + + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PendingTransactionInfo, override) + + void PrintDiagnostics(nsCString& log); + + // Return true if the transaction has claimed a HalfOpen socket or + // a connection in TLS handshake phase. + bool IsAlreadyClaimedInitializingConn(); + + void AbandonHalfOpenAndForgetActiveConn(); + + // Try to claim a halfOpen socket. We can only claim it if it is not + // claimed yet. + bool TryClaimingHalfOpen(HalfOpenSocket* sock); + // Similar as above, but for a ActiveConn that is performing a TLS handshake + // and has only a NullTransaction associated. + bool TryClaimingActiveConn(HttpConnectionBase* conn); + // It is similar as above, but in tihs case the halfOpen is made for this + // PendingTransactionInfo and it is already claimed. + void AddHalfOpen(HalfOpenSocket* sock); + + nsHttpTransaction* Transaction() const { return mTransaction; } + + private: + RefPtr<nsHttpTransaction> mTransaction; + nsWeakPtr mHalfOpen; + nsWeakPtr mActiveConn; + + ~PendingTransactionInfo(); +}; + +class PendingComparator { + public: + bool Equals(const PendingTransactionInfo* aPendingTrans, + const nsAHttpTransaction* aTrans) const { + return aPendingTrans->Transaction() == aTrans; + } +}; + +} // namespace net +} // namespace mozilla + +#endif // !PendingTransactionInfo_h__ |