optimize the nstackx_ctrl memory
Created-by: ye-xiaokang123
Commit-by: ye-xiaokang123
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)
### 二、建议测试周期和提测地址
建议测试完成时间:xxxx.xx.xx
投产上线时间:xxxx.xx.xx
提测地址:CI环境/压测环境
测试账号:
### 三、变更内容
* 3.1 关联PR列表
* 3.2 数据库和部署说明
1. 常规更新
2. 重启unicorn
3. 重启sidekiq
4. 迁移任务:是否有迁移任务,没有写 "无"
5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"
* 3.4 其他技术优化内容(做了什么,变更了什么)
- 重构了 xxxx 代码
- xxxx 算法优化
* 3.5 废弃通知(什么字段、方法弃用?)
* 3.6 后向不兼容变更(是否有无法向后兼容的变更?)
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
自测测试结论:
### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
检查点:
| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx | 否 | 需要 | 不需要 |
| | | | |
接口测试:
性能测试:
并发测试:
其他:
See merge request: openharmony/communication_t2stack!17
t2stack
Description
t2stack is a collective name for the simplified network protocol stack and its supporting middleware for intelligent terminal scenarios. It mainly provides three core capabilities: file transmission, audio and video stream transmission, and device discovery, while being compatible with various operating system platforms.
File transfer capability: Mainly for file transfer, and provide a variety of optimizations in file transfer, such as large and small file collaboration, small file packaging and other purposes.
Streaming capability: Mainly for video streaming and audio streaming scenarios, it implements three competitive solutions, including semi-reliable transmission, adaptive bandwidth evaluation bitrate, and dynamic caching for weak network detection, to optimize user experience.
Device discovery capability: It mainly provides the ability to discover between devices in the local area network, and realizes reliable unicast, power-reducing filtering, and scalable packet structure.
System Architecture
Instructions
t2stack main code directory structure is as follows:
//t2stack
├── fillp # Streaming protocol code
│ ├── include # Dstream External interface code
│ ├── src # Dstream Core code
├── nstackx_congestion # congestion algorithms public module
│ ├── interface # External interface code
│ ├── core # Core code
│ ├── platform # Adaptation code for different platforms
├── nstackx_core # File transfer protocol code
│ ├── dfile # DFile protocol code
│ | ├── include # DFile External interface code
│ | ├── src # DFile Core code
│ ├── platform # Adaptation code for different platforms
├── nstackx_ctrl # ctrl module
│ ├── interface # External interface code
│ ├── core # Core code
│ ├── platform # Adaptation code for different platforms
├── nstackx_util # public module
│ ├── interface # External interface code
│ ├── core # Core code
│ ├── platform # Adaptation code for different platforms
Introduction to the main interface functions
File Transfer
1. Set up a connection.
Step 1: NSTACKX_DFileServer: Create a file transfer server.
Step 2: NSTACKX_DFileClient: Create a file transfer client and connect it to the server.
2. Close the connection.
NSTACKX_DFileClose: closes a file transfer session instance.
3. Transferring Files
NSTACKX_DFileSendFiles: The client sends a file.
NSTACKX_DFileSetStoragePath: Sets the root path for storing received files on the recipient side.
NSTACKX_DFileSetRenameHook: The receiver sets a callback function to rename the file with the same name in the same path to prevent the file from being overwritten.
4. Obtains and sets supported functions.
NSTACKX_DFileGetCapabilities: Obtains the functions supported by the DFile.
NSTACKX_DFileSetCapabilities: Sets the functions to be enabled for the DFile.
5. Interaction Process
Stream Transfer
1. Initialization and Destruction
FtInit: Initializes Fillp before use.
FtDestroy: Destroys Fillp after use.
2. Establish a connection.
FtSocket: creates a socket.
FtBind: The server binds the socket to the address.
FtListen: The server enables the socket to enter the listening state.
FtAccept: The server starts to receive the connection request from the client.
FtConnect: The client invokes this interface to connect to the server.
3. Sending and Receiving
FtSendFrame: The client invokes this interface to send a video frame.
FtRecv: The receiver calls this interface to receive video frames.
4. Close the connection.
FtClose: This interface is invoked to close a connection.


