This is an automated email from the ASF dual-hosted git repository. masaori pushed a commit to branch quic-latest in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/quic-latest by this push: new 9f8001a Cleanup: use type alias of unique_ptr of QUICPacket 9f8001a is described below commit 9f8001a96c9882b232c2e633ca1d4efb34505e35 Author: Masaori Koshiba <masa...@apache.org> AuthorDate: Thu Sep 28 13:53:35 2017 +0900 Cleanup: use type alias of unique_ptr of QUICPacket --- iocore/net/P_QUICNetVConnection.h | 18 +++++++------- iocore/net/QUICNetVConnection.cc | 27 ++++++++++----------- iocore/net/QUICPacketHandler.cc | 2 +- iocore/net/quic/Mock.h | 6 ++--- iocore/net/quic/QUICLossDetector.cc | 4 ++-- iocore/net/quic/QUICLossDetector.h | 6 ++--- iocore/net/quic/QUICPacket.cc | 26 ++++++++++---------- iocore/net/quic/QUICPacket.h | 28 ++++++++-------------- iocore/net/quic/QUICPacketTransmitter.h | 2 +- iocore/net/quic/test/test_QUICLossDetector.cc | 7 +++--- iocore/net/quic/test/test_QUICPacketFactory.cc | 7 +++--- iocore/net/quic/test/test_QUICVersionNegotiator.cc | 2 +- 12 files changed, 61 insertions(+), 74 deletions(-) diff --git a/iocore/net/P_QUICNetVConnection.h b/iocore/net/P_QUICNetVConnection.h index 79d88e4..568e420 100644 --- a/iocore/net/P_QUICNetVConnection.h +++ b/iocore/net/P_QUICNetVConnection.h @@ -159,7 +159,7 @@ public: int state_connection_closing(int event, Event *data); int state_connection_closed(int event, Event *data); void start(SSL_CTX *); - void push_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); + void push_packet(QUICPacketUPtr packet); void free(EThread *t) override; UDPConnection *get_udp_con(); @@ -182,7 +182,7 @@ public: QUICPacketNumber largest_acked_packet_number() override; // QUICConnection (QUICPacketTransmitter) - virtual void transmit_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) override; + virtual void transmit_packet(QUICPacketUPtr packet) override; virtual void retransmit_packet(const QUICPacket &packet) override; virtual Ptr<ProxyMutex> get_packet_transmitter_mutex() override; @@ -230,22 +230,22 @@ private: Event *_packet_write_ready = nullptr; - void _transmit_packet(QUICPacketPtr); + void _transmit_packet(QUICPacketUPtr); void _transmit_frame(QUICFrameUPtr); bool _is_send_frame_avail_more_than(uint32_t size); void _store_frame(ats_unique_buf &buf, size_t &len, bool &retransmittable, QUICPacketType ¤t_packet_type, QUICFrameUPtr frame); void _packetize_frames(); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> _build_packet(ats_unique_buf buf, size_t len, bool retransmittable, - QUICPacketType type = QUICPacketType::UNINITIALIZED); + QUICPacketUPtr _build_packet(ats_unique_buf buf, size_t len, bool retransmittable, + QUICPacketType type = QUICPacketType::UNINITIALIZED); QUICError _recv_and_ack(const uint8_t *payload, uint16_t size, QUICPacketNumber packet_numm); - QUICError _state_handshake_process_initial_client_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); - QUICError _state_handshake_process_client_cleartext_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); - QUICError _state_handshake_process_zero_rtt_protected_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); - QUICError _state_connection_established_process_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); + QUICError _state_handshake_process_initial_client_packet(QUICPacketUPtr packet); + QUICError _state_handshake_process_client_cleartext_packet(QUICPacketUPtr packet); + QUICError _state_handshake_process_zero_rtt_protected_packet(QUICPacketUPtr packet); + QUICError _state_connection_established_process_packet(QUICPacketUPtr packet); QUICError _state_common_receive_packet(); QUICError _state_common_send_packet(); diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 9143af5..c7e1ffb 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -199,7 +199,7 @@ QUICNetVConnection::stream_manager() } void -QUICNetVConnection::_transmit_packet(QUICPacketPtr packet) +QUICNetVConnection::_transmit_packet(QUICPacketUPtr packet) { DebugQUICCon("Packet Type=%s Size=%hu", QUICDebugNames::packet_type(packet->type()), packet->size()); @@ -209,7 +209,7 @@ QUICNetVConnection::_transmit_packet(QUICPacketPtr packet) } void -QUICNetVConnection::transmit_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICNetVConnection::transmit_packet(QUICPacketUPtr packet) { this->_transmit_packet(std::move(packet)); if (!this->_packet_write_ready) { @@ -249,7 +249,7 @@ QUICNetVConnection::get_packet_transmitter_mutex() } void -QUICNetVConnection::push_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICNetVConnection::push_packet(QUICPacketUPtr packet) { DebugQUICCon("type=%s pkt_num=%" PRIu64 " size=%u", QUICDebugNames::packet_type(packet->type()), packet->packet_number(), packet->size()); @@ -371,8 +371,7 @@ QUICNetVConnection::state_handshake(int event, Event *data) switch (event) { case QUIC_EVENT_PACKET_READ_READY: { - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> p = - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(this->_packet_recv_queue.dequeue(), &QUICPacketDeleter::delete_packet); + QUICPacketUPtr p = QUICPacketUPtr(this->_packet_recv_queue.dequeue(), &QUICPacketDeleter::delete_packet); net_activity(this, this_ethread()); switch (p->type()) { @@ -578,7 +577,7 @@ QUICNetVConnection::largest_acked_packet_number() } QUICError -QUICNetVConnection::_state_handshake_process_initial_client_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICNetVConnection::_state_handshake_process_initial_client_packet(QUICPacketUPtr packet) { if (packet->size() < MINIMUM_INITIAL_CLIENT_PACKET_SIZE) { DebugQUICCon("Packet size is smaller than the minimum initial client packet size"); @@ -611,7 +610,7 @@ QUICNetVConnection::_state_handshake_process_initial_client_packet(std::unique_p } QUICError -QUICNetVConnection::_state_handshake_process_client_cleartext_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICNetVConnection::_state_handshake_process_client_cleartext_packet(QUICPacketUPtr packet) { QUICError error = QUICError(QUICErrorClass::NONE); @@ -626,7 +625,7 @@ QUICNetVConnection::_state_handshake_process_client_cleartext_packet(std::unique } QUICError -QUICNetVConnection::_state_handshake_process_zero_rtt_protected_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICNetVConnection::_state_handshake_process_zero_rtt_protected_packet(QUICPacketUPtr packet) { // TODO: Decrypt the packet // decrypt(payload, p); @@ -635,7 +634,7 @@ QUICNetVConnection::_state_handshake_process_zero_rtt_protected_packet(std::uniq } QUICError -QUICNetVConnection::_state_connection_established_process_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICNetVConnection::_state_connection_established_process_packet(QUICPacketUPtr packet) { // TODO: fix size size_t max_plain_txt_len = 2048; @@ -659,8 +658,7 @@ QUICError QUICNetVConnection::_state_common_receive_packet() { QUICError error; - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> p = - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(this->_packet_recv_queue.dequeue(), &QUICPacketDeleter::delete_packet); + QUICPacketUPtr p = QUICPacketUPtr(this->_packet_recv_queue.dequeue(), &QUICPacketDeleter::delete_packet); net_activity(this, this_ethread()); switch (p->type()) { @@ -685,8 +683,7 @@ QUICNetVConnection::_state_common_send_packet() SCOPED_MUTEX_LOCK(packet_transmitter_lock, this->_packet_transmitter_mutex, this_ethread()); while ((packet = this->_packet_send_queue.dequeue()) != nullptr) { this->_packet_handler->send_packet(*packet, this); - this->_loss_detector->on_packet_sent( - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(packet, &QUICPacketDeleter::delete_packet)); + this->_loss_detector->on_packet_sent(QUICPacketUPtr(packet, &QUICPacketDeleter::delete_packet)); } net_activity(this, this_ethread()); @@ -828,10 +825,10 @@ QUICNetVConnection::_recv_and_ack(const uint8_t *payload, uint16_t size, QUICPac return error; } -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICNetVConnection::_build_packet(ats_unique_buf buf, size_t len, bool retransmittable, QUICPacketType type) { - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet(nullptr, &QUICPacketDeleter::delete_null_packet); + QUICPacketUPtr packet(nullptr, &QUICPacketDeleter::delete_null_packet); switch (type) { case QUICPacketType::SERVER_CLEARTEXT: diff --git a/iocore/net/QUICPacketHandler.cc b/iocore/net/QUICPacketHandler.cc index 3558221..7dee08c 100644 --- a/iocore/net/QUICPacketHandler.cc +++ b/iocore/net/QUICPacketHandler.cc @@ -161,7 +161,7 @@ QUICPacketHandler::_recv_packet(int event, UDPPacket *udpPacket) this->action_->continuation->handleEvent(NET_EVENT_ACCEPT, vc); } - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> qPkt = QUICPacketFactory::create(block, vc->largest_received_packet_number()); + QUICPacketUPtr qPkt = QUICPacketFactory::create(block, vc->largest_received_packet_number()); vc->push_packet(std::move(qPkt)); // send to EThread diff --git a/iocore/net/quic/Mock.h b/iocore/net/quic/Mock.h index 73101dd..e866a46 100644 --- a/iocore/net/quic/Mock.h +++ b/iocore/net/quic/Mock.h @@ -145,7 +145,7 @@ public: this->_mutex = new_ProxyMutex(); }; void - transmit_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) override + transmit_packet(QUICPacketUPtr packet) override { ++_transmit_count; } @@ -263,7 +263,7 @@ class MockQUICPacketTransmitter : public QUICPacketTransmitter public: MockQUICPacketTransmitter() : QUICPacketTransmitter() { this->_mutex = new_ProxyMutex(); }; void - transmit_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) override + transmit_packet(QUICPacketUPtr packet) override { ++_transmit_count; } @@ -313,7 +313,7 @@ public: } void - on_packet_sent(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) + on_packet_sent(QUICPacketUPtr packet) { } }; diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc index 46ded5a..91a5328 100644 --- a/iocore/net/quic/QUICLossDetector.cc +++ b/iocore/net/quic/QUICLossDetector.cc @@ -144,7 +144,7 @@ QUICLossDetector::_detect_lost_packets(QUICPacketNumber largest_acked_packet_num } void -QUICLossDetector::on_packet_sent(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) +QUICLossDetector::on_packet_sent(QUICPacketUPtr packet) { bool is_handshake = false; QUICPacketType type = packet->type(); @@ -161,7 +161,7 @@ QUICLossDetector::on_packet_sent(std::unique_ptr<QUICPacket, QUICPacketDeleterFu void QUICLossDetector::_on_packet_sent(QUICPacketNumber packet_number, bool is_retransmittable, bool is_handshake, size_t sent_bytes, - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) + QUICPacketUPtr packet) { SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread()); this->_largest_sent_packet = packet_number; diff --git a/iocore/net/quic/QUICLossDetector.h b/iocore/net/quic/QUICLossDetector.h index 82bfa9b..5b52b55 100644 --- a/iocore/net/quic/QUICLossDetector.h +++ b/iocore/net/quic/QUICLossDetector.h @@ -47,7 +47,7 @@ public: std::vector<QUICFrameType> interests() override; virtual QUICError handle_frame(std::shared_ptr<const QUICFrame>) override; - void on_packet_sent(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); + void on_packet_sent(QUICPacketUPtr packet); QUICPacketNumber largest_acked_packet_number(); private: @@ -57,7 +57,7 @@ private: bool retransmittable; bool handshake; size_t bytes; - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet; + QUICPacketUPtr packet; }; bool _time_loss_detection = false; @@ -95,7 +95,7 @@ private: void _decrement_packet_count(QUICPacketNumber packet_number); void _on_packet_sent(QUICPacketNumber packet_number, bool is_retransmittable, bool is_handshake, size_t sent_bytes, - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet); + QUICPacketUPtr packet); void _on_ack_received(const std::shared_ptr<const QUICAckFrame> &ack_frame); void _on_packet_acked(QUICPacketNumber acked_packet_number); void _update_rtt(uint32_t latest_rtt); diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc index 97e62c6..bf0e1f9 100644 --- a/iocore/net/quic/QUICPacket.cc +++ b/iocore/net/quic/QUICPacket.cc @@ -690,15 +690,15 @@ QUICPacket::decode_packet_number(QUICPacketNumber &dst, QUICPacketNumber src, si // // QUICPacketFactory // -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICPacketFactory::create(IOBufferBlock *block, QUICPacketNumber base_packet_number) { QUICPacket *packet = quicPacketAllocator.alloc(); new (packet) QUICPacket(block, base_packet_number); - return std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(packet, &QUICPacketDeleter::delete_packet); + return QUICPacketUPtr(packet, &QUICPacketDeleter::delete_packet); } -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICPacketFactory::create_version_negotiation_packet(const QUICPacket *packet_sent_by_client, QUICPacketNumber base_packet_number) { size_t len = sizeof(QUICVersion) * countof(QUIC_SUPPORTED_VERSIONS); @@ -715,20 +715,20 @@ QUICPacketFactory::create_version_negotiation_packet(const QUICPacket *packet_se new (packet) QUICPacket(QUICPacketType::VERSION_NEGOTIATION, packet_sent_by_client->connection_id(), packet_sent_by_client->packet_number(), base_packet_number, packet_sent_by_client->version(), std::move(versions), len, false); - return std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(packet, QUICPacketDeleter::delete_packet); + return QUICPacketUPtr(packet, QUICPacketDeleter::delete_packet); } -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICPacketFactory::create_server_cleartext_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, ats_unique_buf payload, size_t len, bool retransmittable) { QUICPacket *p = quicPacketAllocator.alloc(); new (p) QUICPacket(QUICPacketType::SERVER_CLEARTEXT, connection_id, this->_packet_number_generator.next(), base_packet_number, this->_version, std::move(payload), len, retransmittable); - return std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(p, &QUICPacketDeleter::delete_packet); + return QUICPacketUPtr(p, &QUICPacketDeleter::delete_packet); } -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICPacketFactory::create_server_protected_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, ats_unique_buf payload, size_t len, bool retransmittable) { @@ -736,7 +736,7 @@ QUICPacketFactory::create_server_protected_packet(QUICConnectionId connection_id QUICPacket *p = quicPacketAllocator.alloc(); new (p) QUICPacket(QUICPacketType::ONE_RTT_PROTECTED_KEY_PHASE_0, connection_id, this->_packet_number_generator.next(), base_packet_number, std::move(payload), len, retransmittable); - auto packet = std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(p, &QUICPacketDeleter::delete_packet); + auto packet = QUICPacketUPtr(p, &QUICPacketDeleter::delete_packet); // TODO: use pmtu of UnixNetVConnection size_t max_cipher_txt_len = 2048; @@ -756,26 +756,26 @@ QUICPacketFactory::create_server_protected_packet(QUICConnectionId connection_id return packet; } else { Debug("quic_packet_factory", "CRYPTOGRAPHIC Error"); - return std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(nullptr, &QUICPacketDeleter::delete_null_packet); + return QUICPacketUPtr(nullptr, &QUICPacketDeleter::delete_null_packet); } } -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICPacketFactory::create_client_initial_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, QUICVersion version, ats_unique_buf payload, size_t len) { QUICPacket *packet = quicPacketAllocator.alloc(); new (packet) QUICPacket(QUICPacketType::CLIENT_INITIAL, connection_id, this->_packet_number_generator.next(), base_packet_number, version, std::move(payload), len, true); - return std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(packet, &QUICPacketDeleter::delete_packet); + return QUICPacketUPtr(packet, &QUICPacketDeleter::delete_packet); } -std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> +QUICPacketUPtr QUICPacketFactory::create_stateless_reset_packet(QUICConnectionId connection_id, QUICStatelessToken stateless_reset_token) { QUICPacket *packet = quicPacketAllocator.alloc(); new (packet) QUICPacket(QUICPacketType::STATELESS_RESET, connection_id, stateless_reset_token); - return std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>(packet, &QUICPacketDeleter::delete_packet); + return QUICPacketUPtr(packet, &QUICPacketDeleter::delete_packet); } void diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h index 9f577e9..94067ae 100644 --- a/iocore/net/quic/QUICPacket.h +++ b/iocore/net/quic/QUICPacket.h @@ -181,7 +181,7 @@ private: }; using QUICPacketDeleterFunc = void (*)(QUICPacket *p); -using QUICPacketPtr = std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>; +using QUICPacketUPtr = std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>; extern ClassAllocator<QUICPacket> quicPacketAllocator; extern ClassAllocator<QUICPacketLongHeader> quicPacketLongHeaderAllocator; @@ -206,23 +206,15 @@ public: class QUICPacketFactory { public: - static std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> create(IOBufferBlock *block, QUICPacketNumber base_packet_number); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> create_version_negotiation_packet(const QUICPacket *packet_sent_by_client, - QUICPacketNumber base_packet_number); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> create_server_cleartext_packet(QUICConnectionId connection_id, - QUICPacketNumber base_packet_number, - ats_unique_buf payload, size_t len, - bool retransmittable); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> create_server_protected_packet(QUICConnectionId connection_id, - QUICPacketNumber base_packet_number, - ats_unique_buf payload, size_t len, - bool retransmittable); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> create_client_initial_packet(QUICConnectionId connection_id, - QUICPacketNumber base_packet_number, - QUICVersion version, ats_unique_buf payload, - size_t len); - static std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> create_stateless_reset_packet(QUICConnectionId connection_id, - QUICStatelessToken stateless_reset_token); + static QUICPacketUPtr create(IOBufferBlock *block, QUICPacketNumber base_packet_number); + QUICPacketUPtr create_version_negotiation_packet(const QUICPacket *packet_sent_by_client, QUICPacketNumber base_packet_number); + QUICPacketUPtr create_server_cleartext_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, + ats_unique_buf payload, size_t len, bool retransmittable); + QUICPacketUPtr create_server_protected_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, + ats_unique_buf payload, size_t len, bool retransmittable); + QUICPacketUPtr create_client_initial_packet(QUICConnectionId connection_id, QUICPacketNumber base_packet_number, + QUICVersion version, ats_unique_buf payload, size_t len); + static QUICPacketUPtr create_stateless_reset_packet(QUICConnectionId connection_id, QUICStatelessToken stateless_reset_token); void set_version(QUICVersion negotiated_version); void set_crypto_module(QUICCrypto *crypto); diff --git a/iocore/net/quic/QUICPacketTransmitter.h b/iocore/net/quic/QUICPacketTransmitter.h index 6aaef38..323c98d 100644 --- a/iocore/net/quic/QUICPacketTransmitter.h +++ b/iocore/net/quic/QUICPacketTransmitter.h @@ -33,7 +33,7 @@ public: * * This sends QUIC_PACKET_WRITE_READY event. */ - virtual void transmit_packet(std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet) = 0; + virtual void transmit_packet(QUICPacketUPtr packet) = 0; /* * Enqueue a packet for retransmission diff --git a/iocore/net/quic/test/test_QUICLossDetector.cc b/iocore/net/quic/test/test_QUICLossDetector.cc index e77670d..543249b 100644 --- a/iocore/net/quic/test/test_QUICLossDetector.cc +++ b/iocore/net/quic/test/test_QUICLossDetector.cc @@ -40,10 +40,9 @@ TEST_CASE("QUICLossDetector_Loss_in_Handshake", "[quic]") ats_unique_buf payload = ats_unique_malloc(sizeof(raw)); memcpy(payload.get(), raw, sizeof(raw)); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet = std::unique_ptr<QUICPacket, QUICPacketDeleterFunc>( - new QUICPacket(QUICPacketType::SERVER_CLEARTEXT, 0xffddbb9977553311ULL, 0x00000001, 0, 0x00112233, std::move(payload), - sizeof(raw), true), - [](QUICPacket *p) { delete p; }); + QUICPacketUPtr packet = QUICPacketUPtr(new QUICPacket(QUICPacketType::SERVER_CLEARTEXT, 0xffddbb9977553311ULL, 0x00000001, 0, + 0x00112233, std::move(payload), sizeof(raw), true), + [](QUICPacket *p) { delete p; }); detector.on_packet_sent(std::move(packet)); ink_hrtime_sleep(HRTIME_MSECONDS(1000)); CHECK(tx->_retransmit_count > 0); diff --git a/iocore/net/quic/test/test_QUICPacketFactory.cc b/iocore/net/quic/test/test_QUICPacketFactory.cc index 02d2b64..fbf6a87 100644 --- a/iocore/net/quic/test/test_QUICPacketFactory.cc +++ b/iocore/net/quic/test/test_QUICPacketFactory.cc @@ -44,7 +44,7 @@ TEST_CASE("QUICPacketFactory_Create_VersionNegotiationPacket", "[quic]") QUICPacket client_initial_packet(block, 0); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet = factory.create_version_negotiation_packet(&client_initial_packet, 0); + QUICPacketUPtr packet = factory.create_version_negotiation_packet(&client_initial_packet, 0); CHECK(packet->type() == QUICPacketType::VERSION_NEGOTIATION); CHECK(packet->connection_id() == client_initial_packet.connection_id()); CHECK(packet->packet_number() == client_initial_packet.packet_number()); @@ -60,8 +60,7 @@ TEST_CASE("QUICPacketFactory_Create_ServerCleartextPacket", "[quic]") ats_unique_buf payload = ats_unique_malloc(sizeof(raw)); memcpy(payload.get(), raw, sizeof(raw)); - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet = - factory.create_server_cleartext_packet(0x01020304, 0, std::move(payload), sizeof(raw), true); + QUICPacketUPtr packet = factory.create_server_cleartext_packet(0x01020304, 0, std::move(payload), sizeof(raw), true); CHECK(packet->type() == QUICPacketType::SERVER_CLEARTEXT); CHECK(packet->connection_id() == 0x01020304); CHECK(memcmp(packet->payload(), raw, sizeof(raw)) == 0); @@ -84,7 +83,7 @@ TEST_CASE("QUICPacketFactory_Create_StatelessResetPacket", "[quic]") uint8_t output[1024]; size_t out_len = 0; - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> packet = factory.create_stateless_reset_packet(0x01020304, token); + QUICPacketUPtr packet = factory.create_stateless_reset_packet(0x01020304, token); CHECK(packet->type() == QUICPacketType::STATELESS_RESET); CHECK(packet->connection_id() == 0x01020304); CHECK(packet->packet_number() == token.get_u8()[0]); diff --git a/iocore/net/quic/test/test_QUICVersionNegotiator.cc b/iocore/net/quic/test/test_QUICVersionNegotiator.cc index 1802c63..e2971d5 100644 --- a/iocore/net/quic/test/test_QUICVersionNegotiator.cc +++ b/iocore/net/quic/test/test_QUICVersionNegotiator.cc @@ -35,7 +35,7 @@ TEST_CASE("QUICVersionNegotiator_Normal", "[quic]") CHECK(vn.status() == QUICVersionNegotiationStatus::NOT_NEGOTIATED); // Negotiate version - std::unique_ptr<QUICPacket, QUICPacketDeleterFunc> initial_packet = + QUICPacketUPtr initial_packet = packet_factory.create_client_initial_packet({}, 0, QUIC_SUPPORTED_VERSIONS[0], ats_unique_malloc(0), 0); vn.negotiate(initial_packet.get()); CHECK(vn.status() == QUICVersionNegotiationStatus::NEGOTIATED); -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].