Skip to content

Commit

Permalink
quic重置
Browse files Browse the repository at this point in the history
  • Loading branch information
garenwang committed Jan 8, 2024
1 parent 1615d87 commit 0b31321
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 17 deletions.
2 changes: 1 addition & 1 deletion QCloudQuic.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.name = "QCloudQuic"


s.version = "6.3.3"
s.version = "6.3.2"


s.summary = "QCloudQuic 腾讯云iOS-SDK组件"
Expand Down
20 changes: 20 additions & 0 deletions QCloudQuic/Classes/QCloudBase/QCloudQuicConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSInteger tcp_port;
// 设置拥塞算法,默认值即为BBR
@property (nonatomic,assign)QCloudCongestionType congestion_type;

// ConnectWithDomain get ipv6 ip if true, false defaultly.
@property (nonatomic,assign) bool support_v6_;

@property (nonatomic,assign) bool isCongetionOptimizationEnabled_;

@property (nonatomic,assign) NSInteger mp_strategy_;

// The max receive window for a whole session.
// unit is bytes, default is 15 MB, max is 24 MB
// The window size of session must be larger than
// a single stream's size. This size affects all
// the streams within this session.
@property (nonatomic,assign) NSUInteger nSessionMaxRecvWindowSize;

// The max receive window for a single stream
// unit is bytes, default is 6 MB, max is 16 MB
@property (nonatomic,assign) NSUInteger nStreamMaxRecvWindowSize;
// 默认:true
@property (nonatomic,assign) bool use_session_reuse_;
@end

NS_ASSUME_NONNULL_END
1 change: 1 addition & 0 deletions QCloudQuic/Classes/QCloudBase/QCloudQuicConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ - (instancetype)init
self.race_type = QCloudRaceTypeOnlyQUIC;
self.congestion_type = QCloudCongestionTypeBBR;
self.is_custom = NO;
self.use_session_reuse_ = NO;
return self;
}
@end
16 changes: 15 additions & 1 deletion QCloudQuic/Classes/QCloudBase/TquicConnection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,25 @@ -(void)onHandleQuicRequest:(TquicRequest *)quicRequest didConnect:(TquicRequest
}
config.race_type = raceType;
config.total_timeout_millisec_ =[QCloudQuicConfig shareConfig].total_timeout_millisec_;

config.support_v6_ = [QCloudQuicConfig shareConfig].support_v6_;

config.isCongetionOptimizationEnabled_ = [QCloudQuicConfig shareConfig].isCongetionOptimizationEnabled_;
config.mp_strategy_ = [QCloudQuicConfig shareConfig].mp_strategy_;

config.connect_timeout_millisec_ = [QCloudQuicConfig shareConfig].connect_timeout_millisec_;
if ([QCloudQuicConfig shareConfig].nStreamMaxRecvWindowSize > 0) {
config.nStreamMaxRecvWindowSize = [QCloudQuicConfig shareConfig].nStreamMaxRecvWindowSize;
}

if ([QCloudQuicConfig shareConfig].nSessionMaxRecvWindowSize > 0) {
config.nSessionMaxRecvWindowSize = [QCloudQuicConfig shareConfig].nSessionMaxRecvWindowSize;
}
config.use_session_reuse_ = [QCloudQuicConfig shareConfig].use_session_reuse_;

// 设置连接空闲时间,单位为ms,默认值为与服务端协商值,一般为90000ms
config.idle_timeout_millisec_ = [QCloudQuicConfig shareConfig].idle_timeout_millisec_;
config.is_custom_ = [QCloudQuicConfig shareConfig].is_custom;
config.use_session_reuse_ = NO;
request_sp.reset(new TnetQuicRequest(tquic_delegate_sp.get(),config));
tquic_delegate_sp.get()->request_sp = request_sp;
self.quicReqeust = quicRequest;
Expand Down
4 changes: 2 additions & 2 deletions QCloudQuic/Classes/QCloudQuicVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

#ifndef QCloudQuicModuleVersion_h
#define QCloudQuicModuleVersion_h
#define QCloudQuicModuleVersionNumber 603003
#define QCloudQuicModuleVersionNumber 603002

//dependency

//
FOUNDATION_EXTERN NSString * const QCloudQuicModuleVersion;
FOUNDATION_EXTERN NSString * const QCloudQuicModuleName;

#endif
#endif
4 changes: 2 additions & 2 deletions QCloudQuic/Classes/QCloudQuicVersion.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "QCloudQuicVersion.h"
NSString * const QCloudQuicModuleVersion = @"6.3.3";
NSString * const QCloudQuicModuleVersion = @"6.3.2";
NSString * const QCloudQuicModuleName = @"QCloudQuic";
@interface QCloudQCloudQuicLoad : NSObject
@end
Expand All @@ -26,4 +26,4 @@ + (void) load
#pragma clang diagnostic pop
}
}
@end
@end
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#endif

#include <cstdint>
//#include <vector>
//#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"

namespace stgw {
class TnetRequestFront;
Expand All @@ -34,6 +36,7 @@ struct TnetStats {
bool is_quic; // if it is quic, else it is tcp.
bool is_0rtt; // Only valid if it is quic.
bool is_conn_reuse; // if reuse an exist quic connection.
bool is_multipath_;
std::uint64_t connect_ms; // connect cost in millionseconds.
std::uint64_t ttfb_ms; // first byte cost from send request in millionseconds.

Expand All @@ -48,21 +51,35 @@ struct TnetStats {
std::uint64_t packets_lost; // Number of packets be lost when sent data.
std::uint64_t packets_received; // Total packets received
std::uint64_t bytes_received; // Total bytes received including packet format.
std::uint64_t stream_bytes_received; // Total bytes received including duplicated data.
std::uint64_t stream_bytes_sent; // Non-retransmitted bytes sent in a stream frame.
std::uint64_t stream_bytes_received; // Bytes received in a stream frame.
std::uint64_t dns_ms;
std::uint64_t cancel_duration_ms;
std::uint64_t shlo_duration_ms;
std::uint64_t preprocess_duration_ms;
std::uint32_t cancel_duration_ms;
std::uint32_t shlo_duration_ms;
std::uint32_t preprocess_duration_ms;
std::uint32_t mp_nego_ms;
std::uint32_t mp_succ_ms;
std::uint32_t ma_st_rcv;
std::uint32_t mp_st_rcv;
std::uint32_t pre_strcv1;
std::uint32_t pre_strcv2;
std::int32_t mp_ft_offset;
std::int32_t mp_tot_ms;
int stream_error;
int dns_code;
int error_code;
bool is_default_ip;
char remote_ip[64];
char conn_id[32];
char conn_id[64];
int engine_type; // only used if ConnectAndSend
int sock_bind_type; // only used if ConnectAndSend
int migration_count;
int sock_avail_type;
int multi_request_type;
int avail_request_type;
int detect_result;
int persist_result;
char detect_str[16];
};

enum CongestionType {
Expand All @@ -83,6 +100,7 @@ class TNET_EXPORT TnetConfig {
public:
TnetConfig();
TnetConfig(const TnetConfig& c);
~TnetConfig();
// The max receive window for a whole session.
// unit is bytes, default is 15 MB, max is 24 MB
// The window size of session must be larger than
Expand Down Expand Up @@ -122,7 +140,7 @@ class TNET_EXPORT TnetConfig {
// 4000 milliseconds defaultly before handshake complete.
// 600 seconds defaultly after handshake.
int idle_timeout_millisec_;
// Specify quic version, only support quic 39-46, it is 43 defaultly.
// Specify quic version, only support quic 43-80, it is 43 defaultly.
int quic_version_;

// default is false.
Expand All @@ -131,15 +149,31 @@ class TNET_EXPORT TnetConfig {
// default is false.
bool force_zero_rtt_;

// ConnectWithDomain get ipv6 ip if true, false defaultly.
bool support_v6_;

bool isCongetionOptimizationEnabled_;

bool debug_use_1rtt_;
int mp_strategy_;
// The following parameters with debug_* is used for testing.
// number of active connection id provided by client. if not set, default is 8.
int debug_active_connection_id_num_;
// number of path when multipath is enable. if not set, dafault is 2.
int debug_multipath_num_;
// Client IP address bind to each path, when multipath is enable.
//std::vector<quic::QuicSocketAddress> debug_client_addresses_;
};


class TNET_EXPORT TnetRequestDelegate {
public:
TnetRequestDelegate() {}
virtual ~TnetRequestDelegate() {}
// Called when the handshake with server compeleted.
virtual void OnConnect(int error_code) = 0;
// Represents that network is linkable.
virtual void OnNetworkLinked() {}
// Called when data is available.
virtual void OnDataRecv(const char* buf,
const int buf_len) = 0;
Expand Down Expand Up @@ -176,10 +210,17 @@ class TNET_EXPORT TnetQuicRequest {
// only for quic.
void ConnectWithDomain(const char* host,
const int port);


void ConnAndReq(const char* host,
const int port,
const char* direct_ip,
const char* body,
const int body_len);

// only for quic, is fin directly
void ConnectAndSend(const char* host,
const int port,
const char* default_ip,
const char* body,
const int body_len,
bool fin);
Expand All @@ -192,7 +233,8 @@ class TNET_EXPORT TnetQuicRequest {
Other headers can set as usual format.
*/
void AddHeaders(const char* key,
const char* value);
const char* value,
const bool is_covered = true);
// Return true if the handshake with server is compeleted.
bool IsConnected();

Expand All @@ -211,6 +253,8 @@ class TNET_EXPORT TnetQuicRequest {
// Get statistics for the last request.
TnetStats GetTnetStates();

void SetAlpn(const char* alpn_);

private:
TnetQuicRequest();
stgw::TnetRequestFront* front_;
Expand All @@ -225,20 +269,36 @@ extern "C" {
// and create a new file.
// if delete_old_file = false, log would be append to exist file,
// if file not exist, then create a new file.
// log_level value:
// * verbose : -1
// * info: 0
// * warning: 1
// * error: 2
// * fatal: 3
#if defined(WIN32)
TNET_EXPORT void SetTquicLog(const wchar_t* filepath, bool delete_old_file);
TNET_EXPORT void SetTquicLog(const wchar_t* filepath,
bool delete_old_file,
int log_level = 1);
#else
TNET_EXPORT void SetTquicLog(const char* filepath, bool delete_old_file);
TNET_EXPORT void SetTquicLog(const char* filepath,
bool delete_old_file,
int log_level = 1);
#endif

// Get tquic-sdk version, should be 1.3.9.0
// Get tquic-sdk version, should be 1.4.48
TNET_EXPORT const char* GetTquicVersion();

// only for quic
TNET_EXPORT void TquicPreconnect(const char* domain,
const char* default_ip,
const int port);

TNET_EXPORT void TquicCleanDns();


// For splash ad experiment
TNET_EXPORT void set_tquic_expid(int exp_id);

#ifdef __cplusplus
}
#endif
Expand Down
Binary file modified QCloudQuic/Classes/QuicFramework/Tquic.framework/Info.plist
Binary file not shown.
Binary file modified QCloudQuic/Classes/QuicFramework/Tquic.framework/Tquic
Binary file not shown.

0 comments on commit 0b31321

Please sign in to comment.