Message forwarding method and device, electronic equipment and storage medium

By performing feature extraction and recombination calculations on messages at the software level, and using hash linked list to detect message data, the problems of hardware memory usage and processing efficiency are solved, and efficient message processing and memory optimization are achieved.

CN120602447APending Publication Date: 2025-09-05HANGZHOU DPTECH INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510848289.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

In the prior art, when processing packet data, the device needs to send data to hardware memory, resulting in a long data transfer chain, low processing efficiency, and occupies hardware memory resources.

Method used

Feature extraction calculation is performed by receiving message data, the first feature value is obtained, and the feature extraction calculation is performed after reorganization, and the second feature value is obtained, and the message data is detected in the hash link list. If it does not exist, the message data is forwarded, and only the feature value and time are stored in the software memory.

Benefits of technology

It improves packet processing efficiency, reduces the use of hardware memory, solves hash conflict problem, and optimizes memory resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602447A_ABST
    Figure CN120602447A_ABST
Patent Text Reader

Abstract

The invention provides a message forwarding method and device, electronic equipment and a storage medium, and the method comprises the steps: receiving message data, and carrying out the feature extraction calculation of the message data, and obtaining a first feature value; recombining the message data, and performing feature extraction calculation on the recombined message data to obtain a second feature value; detecting whether message data represented by the second characteristic value exists in a hash chain table corresponding to the first characteristic value or not; and if the message data represented by the second characteristic value does not exist in the hash chain table corresponding to the first characteristic value, forwarding the message data. Therefore, when the Hash conflict is solved through double verification, only the characteristic value and the moment of the message data need to be stored in the software memory, on one hand, the data link of data issuing is short, the message processing efficiency is improved, on the other hand, the complete message does not need to be stored in the hardware memory, and the occupation of the hardware memory is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present disclosure relate to the field of message processing technology, and in particular to a message forwarding method, device, electronic device, and storage medium. Background Art

[0002] In related technologies, after receiving message data at a port or CPU (Central Processing Unit), a device parses the message data and uses a cyclic redundancy check (CRC) or message digest algorithm to calculate a value as an index. The value then stores the message data and the time the message entered the device in hardware memory. When a new message arrives, an index is calculated for the new message and the message information and time are compared in the hardware memory based on the index to determine how to handle the new message.

[0003] However, related technologies require that message data be sent to hardware memory, resulting in a long data transmission chain and low message processing efficiency. In addition, storing complete message data in the hardware memory occupies hardware memory resources. Summary of the Invention

[0004] The present disclosure provides a message forwarding method, the method comprising:

[0005] Receive message data, and perform feature extraction calculation on the message data to obtain a first feature value;

[0006] Reorganizing the message data, and performing feature extraction calculation on the reorganized message data to obtain a second feature value;

[0007] Detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value;

[0008] If the message data represented by the second characteristic value does not exist in the hash chain table corresponding to the first characteristic value, the message data is forwarded.

[0009] Optionally, the received message data includes:

[0010] receiving message data, and recording the time of receiving the message data;

[0011] After detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the method further includes:

[0012] If the message data represented by the second characteristic value exists in the hash chain table corresponding to the first characteristic value, determining a first time difference between the time of the message data and the time of the message data represented by the second characteristic value;

[0013] If the first time difference is within the preset message deduplication time, the message data is discarded, and the time of the message data represented by the second characteristic value is updated to the time of receiving the message data.

[0014] Optionally, the received message data includes:

[0015] receiving message data, and recording the time of receiving the message data;

[0016] After detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the method further includes:

[0017] If the message data represented by the second characteristic value exists in the hash chain table corresponding to the first characteristic value, determining a first time difference between the time of the message data and the time of the message data represented by the second characteristic value;

[0018] If the first time difference is not within the preset message deduplication time, the message data is forwarded, and the time of the message data represented by the second characteristic value is updated to the time of receiving the message data.

[0019] Optionally, the received message data includes:

[0020] receiving message data, and recording the time of receiving the message data;

[0021] After forwarding the message data, the method further includes:

[0022] The second characteristic value representing the message data and the time of receiving the message data are stored in a node in the hash linked table corresponding to the first characteristic value.

[0023] Optionally, storing the second characteristic value representing the message data and the time of receiving the message data in a node in the hash linked table corresponding to the first characteristic value includes:

[0024] Detecting the number of nodes in the hash linked table corresponding to the first eigenvalue;

[0025] If the number of nodes does not exceed the preset number of nodes in the hash linked table, the second characteristic value representing the message data and the time of receiving the message data are stored in a node in the hash linked table corresponding to the first characteristic value.

[0026] Optionally, the method further includes:

[0027] Traversing each node in the overall hash chain list, and when traversing to a node, calculating the second time difference between the time when the message data stored in the node is stored and the time when the node is traversed;

[0028] If the second time difference is not within the time corresponding to the preset node aging time, the traversed node is deleted.

[0029] Optionally, the received message data includes:

[0030] receiving message data, and recording the time of receiving the message data;

[0031] The forwarding of the message data includes:

[0032] Detecting the number of nodes in the hash linked table corresponding to the first eigenvalue;

[0033] If the number of nodes exceeds the preset number of nodes in the hash linked table, the message data is forwarded.

[0034] The present disclosure also provides a message forwarding device, the device comprising:

[0035] a receiving unit, configured to receive message data and perform feature extraction calculation on the message data to obtain a first feature value;

[0036] a reassembly unit, configured to reassemble the message data and perform feature extraction calculation on the reassembled message data to obtain a second feature value;

[0037] A detection unit, configured to detect whether message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value;

[0038] A forwarding unit is configured to forward the message data if the message data represented by the second characteristic value does not exist in the hash linked table corresponding to the first characteristic value.

[0039] The present disclosure further provides an electronic device, comprising a communication interface, a processor, a memory, and a bus, wherein the communication interface, the processor, and the memory are interconnected via the bus;

[0040] The memory stores machine-readable instructions, and the processor executes the above method by calling the machine-readable instructions.

[0041] The present disclosure also provides a machine-readable storage medium, wherein the machine-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, the above method is implemented.

[0042] According to the embodiments of the present disclosure, first, message data is received, and feature extraction and calculation are performed on the message data to obtain a first feature value; then, the message data is reorganized, and feature extraction and calculation are performed on the reorganized message data to obtain a second feature value; further, it is detected whether the message data represented by the second feature value exists in the hash linked table corresponding to the first feature value; finally, if the message data represented by the second feature value does not exist in the hash linked table corresponding to the first feature value, the message data is forwarded.

[0043] Through the above method, the technical solution disclosed in the present invention only needs to store the characteristic values ​​and time of the message data in the software memory while solving the hash conflict through double verification. On the one hand, the data chain for data transmission is short and the message processing efficiency is improved. On the other hand, there is no need to store the complete message in the hardware memory, which reduces the occupancy of the hardware memory. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0045] Figure 1 This is a flowchart of a message forwarding method shown in an exemplary embodiment;

[0046] Figure 2 This is a flowchart showing a hash linked table storing message data according to an exemplary embodiment;

[0047] Figure 3 is a flow chart of another message forwarding method shown in an exemplary embodiment;

[0048] Figure 4 is a hardware structure diagram of an electronic device shown in an exemplary embodiment;

[0049] Figure 5 It is a block diagram of a message forwarding device shown in an exemplary embodiment. DETAILED DESCRIPTION

[0050] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present disclosure.

[0051] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this disclosure. In some other embodiments, the method may include more or fewer steps than those described in this disclosure. In addition, a single step described in this disclosure may be broken down into multiple steps for description in other embodiments; and multiple steps described in this disclosure may be combined into a single step for description in other embodiments.

[0052] In related technologies, after receiving message data at a port or CPU (Central Processing Unit), a device parses the message data and uses a cyclic redundancy check (CRC) or message digest algorithm to calculate a value as an index. The value then stores the message data and the time the message entered the device in hardware memory. When a new message arrives, an index is calculated for the new message and the message information and time are compared in the hardware memory based on the index to determine how to handle the new message.

[0053] However, related technologies require that message data be sent to hardware memory, resulting in a long data transmission chain and low message processing efficiency. In addition, storing complete message data in the hardware memory occupies hardware memory resources.

[0054] In view of this, the present disclosure aims to propose a technical solution for deduplicating and forwarding received messages at the software level.

[0055] This technical solution first receives message data and performs feature extraction and calculation on the message data to obtain a first feature value; then, reorganizes the message data and performs feature extraction and calculation on the reorganized message data to obtain a second feature value; further, detects whether the message data represented by the second feature value exists in the hash chain corresponding to the first feature value; finally, if the message data represented by the second feature value does not exist in the hash chain corresponding to the first feature value, forwards the message data.

[0056] For example, a port or CPU on a device receives a message containing "Hello, World!". The device uses a cyclic redundancy check (CRC) algorithm to calculate the message data: CRC("Hello, World!") = 0x12345678 (the result is a 32-bit value), resulting in a first characteristic value of 0x12345678. The message data is then reassembled using a fixed method, such as by reversing the message content, to obtain the reassembled message: "!dlroW,olleH." The device then uses a cyclic redundancy check (CRC) algorithm to calculate the reassembled message data: CRC("!dlroW,olleH") = 0x87654321 (the result is a 32-bit value), resulting in a second characteristic value of 0x87654321. Next, based on the first eigenvalue 0x12345678 as the hash key, the corresponding hash table is searched and the hash table is traversed to check whether there is a node corresponding to the second eigenvalue 0x87654321. If no matching node is found, it means that the message is a new message, so the message data is forwarded.

[0057] It can be seen that in the technical solution disclosed herein, first, message data is received, and feature extraction and calculation are performed on the message data to obtain a first feature value; then, the message data is reorganized, and feature extraction and calculation are performed on the reorganized message data to obtain a second feature value; further, it is detected whether the message data represented by the second feature value exists in the hash linked table corresponding to the first feature value; finally, if the message data represented by the second feature value does not exist in the hash linked table corresponding to the first feature value, the message data is forwarded.

[0058] Through the above method, the technical solution disclosed in the present invention only needs to store the characteristic values ​​and time of the message data in the software memory while solving the hash conflict through double verification. On the one hand, the data chain for data transmission is short and the message processing efficiency is improved. On the other hand, there is no need to store the complete message in the hardware memory, which reduces the occupancy of the hardware memory.

[0059] The present disclosure is described below through specific embodiments in combination with specific application scenarios.

[0060] See Figure 1 , Figure 1 This is a flow chart of a message forwarding method according to an exemplary embodiment. The method may perform the following steps:

[0061] Step 102: Receive message data, and perform feature extraction calculation on the message data to obtain a first feature value.

[0062] For example, a port or CPU on a device receives a message containing "Hello, World!". The device uses a CRC algorithm to calculate the message data. The calculation process is: CRC("Hello, World!") = 0x12345678 (the calculation result is a 32-bit value), and the first characteristic value is 0x12345678.

[0063] Among them, the port is the interface for the device to communicate with the outside world, which is used to receive and send data. The CPU is the core processing unit of the device, responsible for performing various calculations and logical operations. In the present disclosure, the port or CPU is responsible for receiving message data and executing the deduplication algorithm. Message data refers to information that is encapsulated into a data unit during network transmission, usually including information such as data content, source address, destination address, protocol type, etc. In the present disclosure, message data is the object that needs to be deduplicated. Feature extraction calculation refers to extracting a numerical value or identifier that can represent the characteristics of the data from the data through a specific algorithm. A hash list is a data structure that combines a hash table and a linked list. In the present disclosure, the feature value calculated by the CRC algorithm is used as a hash key to locate the stored array position in the hash list. When the feature values ​​of different messages are mapped to the same array position after calculation by the CRC algorithm (that is, a hash conflict occurs), a linked list is used to store these conflicting data items.

[0064] Step 104: reorganize the message data, and perform feature extraction calculation on the reorganized message data to obtain a second feature value.

[0065] For example, the device reassembles the message data in a fixed manner, such as by reordering the message contents in reverse order, to obtain the reassembled message: "!dlroW,olleH". The device then uses the CRC algorithm to calculate the reassembled message data. The calculation process is: CRC("!dlroW,olleH") = 0x87654321 (the calculation result is a 32-bit value), resulting in the second characteristic value: 0x87654321.

[0066] Message data reassembly refers to the process of reorganizing the original message data according to specific rules. For example, the message content can be reversed or transformed in other specific ways. The purpose of message data reassembly is to generate a data set based on the original message but with a different format to facilitate subsequent processing and analysis. The core of the CRC algorithm is to use the concepts of division and remainder to perform specific operations on the data to generate a short checksum that uniquely identifies the data.

[0067] Step 106: Detect whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value.

[0068] For example, the device uses the first characteristic value 0x12345678 as a hash key, searches the corresponding hash table, and traverses the hash table to check whether there is a node corresponding to the second characteristic value 0x87654321.

[0069] Among them, the first eigenvalue is a 32-bit value obtained by calculating the original message data using the CRC algorithm. The first eigenvalue is used as a hash key to quickly index to a specific position in the hash list. The second eigenvalue is a feature code calculated after some reorganization of the original message data (such as reverse order, segmented scrambling, hash transformation, etc.), which is used to compare with the eigenvalues ​​in the historical records to identify messages with different forms but consistent content, so as to further confirm the uniqueness of the message. In this embodiment, 0x87654321 is the second eigenvalue, which is used to find out whether the same message data exists in the hash list. In the hash list, a node is the basic unit for storing data. Nodes are connected through a linked list to handle hash conflicts.

[0070] Step 108: If the message data represented by the second characteristic value does not exist in the hash chain table corresponding to the first characteristic value, the message data is forwarded.

[0071] For example, if the device does not find the node corresponding to the second characteristic value 0x87654321 in the hash linked table corresponding to the first characteristic value 0x12345678, it means that the message is a new message, so the message data is forwarded.

[0072] After locating a specific location in the hash table, the device traverses the table at that location to check whether there is a node matching the second characteristic value 0x87654321. While traversing the hash table, the device checks whether the second characteristic value of each node matches the second characteristic value of the current message. If no matching node is found, the message is new and the device forwards it.

[0073] It should be noted that the feature extraction calculations used in the technical solutions of the present disclosure include, but are not limited to, CRC (Cyclic Redundancy Check) algorithms, MD5 (Message-Digest) algorithms, hash algorithms, or other custom feature extraction algorithms. The two feature extractions can use the same algorithm or different algorithms. The present disclosure does not limit the type of algorithm used for feature extraction calculations, nor does it limit whether the two feature extractions use the same algorithm.

[0074] Through the above steps, the device can efficiently process incoming message data, avoid the transmission of duplicate messages, and save hardware memory resources.

[0075] In one embodiment shown, the receiving of message data includes: receiving message data, recording the time when the message data is received; after detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the method also includes: if the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, determining the first time difference between the time of the message data and the time of the message data represented by the second characteristic value; if the first time difference is within the preset message deduplication time, discarding the message data, and updating the time of the message data represented by the second characteristic value to the time of receiving the message data.

[0076] For example, a port or CPU of a device receives a message with the content "Hello, World!" and records the time of message reception as 2025-06-17 10:00:00. The device then uses the CRC algorithm to calculate the message data and obtains the first eigenvalue: 0x12345678. The message content is then sorted in reverse order to obtain the reorganized message: "!dlroW,olleH". The CRC algorithm is used again to calculate the second eigenvalue: 0x87654321. The device then uses the first eigenvalue 0x12345678 as the hash key to search the corresponding hash table and finds a node in the hash table with the second eigenvalue 0x87654321. The time of the node is 2025-06-17 09:59:59. The device then calculates the current time 2025-06-17 10:00:00 and the node time 2025-06-17 The duration difference between 09:59:59 is 1 second, assuming that the preset message deduplication duration is 2 seconds. Finally, since the duration difference of 1 second is within the preset message deduplication duration of 2 seconds, the current message data is discarded and the node time is updated to the current time 2025-06-17 10:00:00.

[0077] Among them, when the device port or CPU receives message data, it also records the time when the message is received. This process provides a time reference for subsequent message deduplication, ensuring that it can accurately determine whether the message is repeated within the preset time. The device makes a conditional judgment based on whether the time difference between the message reception time and the reception time stored in the corresponding node in the hash list is within the preset message deduplication time. If it is within the preset message deduplication time, it means that the message is a duplicate message, and the device will discard the message and no longer forward it; in addition, the device will update the time of the corresponding node in the hash list to the reception time of the current message. This operation ensures that the time in the hash list always reflects the latest message reception time, thereby providing an accurate time reference for subsequent message deduplication.

[0078] In one embodiment shown, the receiving of message data includes: receiving message data, recording the time of receiving the message data; after detecting whether the message data represented by the second characteristic value exists in the hash linked list corresponding to the first characteristic value, the method also includes: if the message data represented by the second characteristic value exists in the hash linked list corresponding to the first characteristic value, determining the first time difference between the time of the message data and the time of the message data represented by the second characteristic value; if the first time difference is not within the preset message deduplication time, forwarding the message data, and updating the time of the message data represented by the second characteristic value to the time of receiving the message data.

[0079] For example, a port or CPU of a device receives a message with the content "Hello, World!" and records the time of message reception as 2025-06-17 10:00:00. The device then uses the CRC algorithm to calculate the message data and obtains the first eigenvalue: 0x12345678. The message content is then sorted in reverse order to obtain the reorganized message: "!dlroW,olleH". The CRC algorithm is used again to calculate the second eigenvalue: 0x87654321. The device then uses the first eigenvalue 0x12345678 as the hash key to search the corresponding hash table and finds a node in the hash table with the second eigenvalue 0x87654321. The time of the node is 2025-06-17 09:59:57. The device then calculates the current time 2025-06-17 10:00:00 and the node time 2025-06-17 The time difference between 09:59:57 and 09:59:57 is 3 seconds. Assume that the preset message deduplication time is 2 seconds. Finally, because the time difference of 3 seconds is not within the preset message deduplication time of 2 seconds, the device determines that the current message is not a duplicate message and forwards the message data. In addition, the device updates the node time to the current time 2025-06-17 10:00:00.

[0080] Among them, the hash table is used to store the second characteristic value and time of the message, so as to quickly find and manage the message data. In the present disclosure, by comparing whether the time difference between the message reception time and the reception time stored in the corresponding node in the hash table is within the message deduplication time, it can be determined whether the message is repeated within the deduplication time, and then determine whether the message needs to be discarded or forwarded. If the deduplication time is exceeded, the message is regarded as a new message for forwarding, and the current message reception time is updated. This conditional judgment mechanism ensures the accuracy and efficiency of message deduplication, and ensures that the time in the hash table always reflects the latest message reception time, thereby providing an accurate time reference for subsequent message deduplication.

[0081] In one embodiment shown, the receiving of message data includes: receiving message data and recording the time of receiving the message data; after forwarding the message data, the method also includes: storing a second characteristic value representing the message data and the time of receiving the message data in a node in the hash linked table corresponding to the first characteristic value.

[0082] For example, see Figure 2 , Figure 2 FIG. 1 is a flowchart showing a method of storing message data in a hash table according to an exemplary embodiment. Figure 2 As shown, a port or CPU on a device receives a message and parses it, determining that the message content is "Hello, World!" and recording the message reception time as 2025-06-17 10:00:00. The device then determines whether the corresponding port or CPU has message deduplication enabled. If not, it forwards the message directly. If enabled, the device uses the CRC algorithm to calculate the first characteristic value: 0x12345678. It then reassembles the message and uses the CRC algorithm again to calculate the second characteristic value: 0x87654321. The device then searches the corresponding hash table using the first characteristic value 0x12345678 as the hash key and finds no node in the hash table that matches the second characteristic value 0x87654321. Therefore, the device forwards the message "Hello, World!" After forwarding the message data, the device stores the second characteristic value 0x87654321 and the time of receiving the message data 2025-06-17 10:00:00 in a new node in the hash linked table corresponding to the first characteristic value 0x12345678.

[0083] The time of receiving a message refers to the time information recorded by the system upon receipt of the message data, which is used to subsequently determine whether the message is a duplicate. Upon receiving each message, the device immediately records the current system time. This process is typically performed by hardware or operating system-level interfaces to ensure time accuracy and consistency. The time can be a system timestamp with millisecond or even microsecond accuracy. Forwarding message data involves passing the received message data to the next-hop node or application layer for processing according to the network protocol requirements. In the deduplication mechanism, messages are forwarded only after they are confirmed to be non-duplicates.

[0084] When the received message is determined to be a non-duplicate message and the decision is made to forward the message, the device will insert a new node into the hash table corresponding to the corresponding port or CPU. This node not only contains the calculated second characteristic value, but also records the specific time when the message was received. This information will be encapsulated into a structure or object for easy management and query. The hash table insertion operation is as follows: based on the first characteristic value as the hash key, locate the corresponding hash table. If there is no node in the hash table yet, the newly created node will directly become the first node of the hash table; if other nodes already exist, the new node will be added to the existing node in the form of a linked list. This step usually involves pointer operations, that is, updating the "next node" pointer of the current last node to point to the new node, and setting the "previous node" pointer of the new node to point to the current last node.

[0085] In some embodiments, when the packet deduplication function of a port or CPU is disabled, the device system can automatically destroy the hash table corresponding to the port or CPU and return the occupied memory resources to the device. This is done to optimize resource utilization and avoid unnecessary memory consumption.

[0086] In one embodiment shown, storing the second characteristic value representing the message data and the time of receiving the message data in a node in the hash linked table corresponding to the first characteristic value includes: detecting the number of nodes in the hash linked table corresponding to the first characteristic value; if the number of nodes does not exceed the preset number of nodes in the hash linked table, storing the second characteristic value representing the message data and the time of receiving the message data in a node in the hash linked table corresponding to the first characteristic value.

[0087] For example, a device port or CPU receives a message containing "Hello, World!" and records the time of receipt as 2025-06-17 10:00:00. The device then uses the CRC algorithm to calculate the message data, obtaining the first characteristic value: 0x12345678. After reassembling the message, the CRC algorithm is again calculated, resulting in the second characteristic value: 0x87654321. The device then searches the corresponding hash table using the first characteristic value 0x12345678 as the hash key and finds no node in the table that matches the second characteristic value 0x87654321. Therefore, the device forwards the message data "Hello, World!" After forwarding the message data, the device detects that the number of nodes in the hash table corresponding to the first characteristic value 0x12345678 is 5, which is within the preset number of nodes: 8. Therefore, the device stores the second characteristic value 0x87654321 and the time of receiving the message data 2025-06-17 10:00:00 in a new node in the hash linked table corresponding to the first characteristic value 0x12345678.

[0088] The preset number of hash table nodes is a limit value used to control the maximum number of nodes in the hash table. In this embodiment, the preset number of nodes is 8, indicating that each hash table can store a maximum of 8 nodes. Before inserting a new message node into the hash table, the device checks the number of nodes in the hash table. This process ensures that the hash table does not suffer performance degradation or memory overflow due to storing too many nodes.

[0089] In this embodiment, by limiting the number of nodes in the hash table, the device can optimize the use of storage resources and ensure the search efficiency and storage performance of the hash table. This mechanism is particularly important when processing large amounts of message data, and can effectively prevent the hash table from over-expanding.

[0090] In one embodiment shown, the method also includes: traversing each node in the overall hash linked list, and each time a node is traversed, calculating a second time difference between the time when the message data stored in the node is stored and the time when the node is traversed; if the second time difference is not within the time corresponding to the preset node aging time, deleting the traversed node.

[0091] For example, a port or CPU on a device needs to maintain its corresponding hash table during operation to ensure efficient operation. When the device initializes the hash table, a node aging time of 3 seconds is preset. The device receives a message with the message "Hello, World!" at 2025-06-17 10:00:00. The device calculates the message's first characteristic value (0x12345678) and second characteristic value (0x87654321), and stores the second characteristic value and the reception time as node 1 in the hash table. Subsequently, the device receives multiple messages and calculates characteristic values ​​using the same method, storing them in the hash table. The hash table stores the following nodes: Node 2: Second characteristic value 0x87654321, time 2025-06-17 10:00:03; Node 3: Second characteristic value 0x11223344, time 2025-06-17 10:00:03; Node 4: Second characteristic value 0x55667788, time 2025-06-17 10:00:04. The device starts a maintenance thread to periodically traverse each node in the hash table. If the current traversal time is 2025-06-17 10:00:05, the device calculates the duration differences for nodes 1-4 as 5 seconds, 2 seconds, 2 seconds, and 1 second, respectively. Because the duration difference for node 1 exceeds the preset node aging time of 3 seconds, the device deletes node 1.

[0092] During the traversal process, the device calculates the duration difference of each node and performs a conditional check based on whether the duration difference is within the preset node aging time. If the node's duration difference exceeds the preset aging time, the node is deleted. This mechanism effectively clears outdated nodes, ensuring that nodes in the hash list are always valid, thereby optimizing storage resource usage and ensuring efficient operation of the hash list.

[0093] In one embodiment shown, the receiving of message data includes: receiving message data and recording the time of receiving the message data; forwarding the message data includes: detecting the number of nodes in the hash linked table corresponding to the first characteristic value; if the number of nodes exceeds the preset number of nodes in the hash linked table, forwarding the message data.

[0094] For example, see Figure 3 , Figure 3 FIG. 1 is a flow chart of another message forwarding method shown in an exemplary embodiment. Figure 3As shown, a device port or CPU receives a message, parses it, determines the message content is "Hello, World!", and records the message reception time as 2025-06-17 10:00:00. The device then uses the CRC algorithm to calculate the message data, obtaining the first eigenvalue: 0x12345678. The message is reassembled and the CRC algorithm is used again to calculate the second eigenvalue: 0x87654321. The device then uses the first eigenvalue 0x12345678 as the hash key to search the corresponding hash table and determine whether there is a node in the hash table that matches the second eigenvalue 0x87654321.

[0095] If no matching node exists, and the number of nodes in the hash list is 6, which exceeds the preset number of nodes, the device forwards the message "Hello, World!" If no matching node exists, and the number of nodes in the hash list is 4, which does not exceed the preset number of nodes, the device stores the second characteristic value 0x87654321 and the time the message was received, 2025-06-17 10:00:00, in a new node in the hash list corresponding to the first characteristic value 0x12345678, and forwards the message.

[0096] If there is a matching node, determine whether the time difference between the time stored by the matching node and the time of receiving the current message data exceeds the deduplication time. If it exceeds, the message received this time is no longer considered a duplicate message, the time stored by the matching node is updated and the message received this time is forwarded; if it does not exceed, the message received this time is considered a duplicate message, the time stored by the matching node is updated and the message received this time is discarded.

[0097] By limiting the number of nodes in the hash table, the device can optimize memory usage and ensure efficient hash table searches and storage performance. This mechanism is particularly important when processing large amounts of message data, as it prevents performance degradation caused by excessive hash table storage.

[0098] Corresponding to the above-mentioned embodiment of the message forwarding method, the present disclosure also provides an embodiment of a message forwarding device.

[0099] See Figure 4 , Figure 4This is a hardware structure diagram of an electronic device shown in an exemplary embodiment. At the hardware level, the device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, and of course may also include other required hardware. One or more embodiments of the present disclosure can be implemented based on software, such as the processor 402 reading the corresponding computer program from the non-volatile memory 410 into the memory 408 and then running it. Of course, in addition to software implementation, one or more embodiments of the present disclosure do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0100] See Figure 5 , Figure 5 FIG. 5 is a block diagram of a message forwarding device according to an exemplary embodiment. The message forwarding device 500 can be applied to Figure 4 The electronic device shown in the figure is used to implement the technical solution of the present disclosure. The device includes:

[0101] The receiving unit 502 is configured to receive message data and perform feature extraction calculation on the message data to obtain a first feature value;

[0102] a reassembly unit 504, configured to reassemble the message data and perform feature extraction calculation on the reassembled message data to obtain a second feature value;

[0103] A detection unit 506 is configured to detect whether the message data represented by the second characteristic value exists in the hash chain table corresponding to the first characteristic value;

[0104] The forwarding unit 508 is configured to forward the message data if the message data represented by the second characteristic value does not exist in the hash linked table corresponding to the first characteristic value.

[0105] In some embodiments, the receiving message data includes:

[0106] receiving message data, and recording the time of receiving the message data;

[0107] After detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the device further includes:

[0108] A determining unit 510 is configured to determine a first duration difference between a time instant of the message data and a time instant of the message data represented by the second characteristic value if the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value;

[0109] The discarding unit 512 is configured to discard the message data if the first duration difference is within a preset message deduplication duration, and update the time of the message data represented by the second characteristic value to the time of receiving the message data.

[0110] In some embodiments, the receiving message data includes:

[0111] receiving message data, and recording the time of receiving the message data;

[0112] After detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the device further includes:

[0113] A determining unit 510 is configured to determine a first duration difference between a time instant of the message data and a time instant of the message data represented by the second characteristic value if the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value;

[0114] The updating unit 514 is configured to forward the message data if the first duration difference is not within a preset message deduplication duration, and update the time of the message data represented by the second characteristic value to the time of receiving the message data.

[0115] In some embodiments, the receiving message data includes:

[0116] receiving message data, and recording the time of receiving the message data;

[0117] After forwarding the message data, the device further includes:

[0118] The storage unit 516 is configured to store the second characteristic value representing the message data and the time of receiving the message data in a node in the hash linked table corresponding to the first characteristic value.

[0119] In some embodiments, storing the second characteristic value representing the message data and the time of receiving the message data in a node of the hash linked table corresponding to the first characteristic value includes:

[0120] Detecting the number of nodes in the hash linked table corresponding to the first eigenvalue;

[0121] If the number of nodes does not exceed the preset number of nodes in the hash linked table, the second characteristic value representing the message data and the time of receiving the message data are stored in a node in the hash linked table corresponding to the first characteristic value.

[0122] In some embodiments, the apparatus further comprises:

[0123] The calculation unit 518 is configured to traverse each node in the overall hash chain list, and when traversing to a node, calculate a second time difference between the time when the message data stored in the node is received and the time when the node is traversed;

[0124] The deleting unit 520 is configured to delete the traversed node if the second time difference is not within the time corresponding to the preset node aging time.

[0125] In some embodiments, the receiving message data includes:

[0126] receiving message data, and recording the time of receiving the message data;

[0127] The forwarding of the message data includes:

[0128] Detecting the number of nodes in the hash linked table corresponding to the first eigenvalue;

[0129] If the number of nodes exceeds the preset number of nodes in the hash linked table, the message data is forwarded.

[0130] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0131] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the disclosed solution. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0132] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.

[0133] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0134] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0135] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0136] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0137] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0138] The foregoing description describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0139] The terms used in one or more embodiments of the present disclosure are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present disclosure. The singular forms "a," "the," and "the" used in one or more embodiments of the present disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0140] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of the present disclosure, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0141] The above description is merely a preferred embodiment of one or more embodiments of the present disclosure and is not intended to limit one or more embodiments of the present disclosure. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present disclosure shall be included in the scope of protection of one or more embodiments of the present disclosure.

Claims

1. A message forwarding method, characterized in that: The method comprises: Receive message data, and perform feature extraction calculation on the message data to obtain a first feature value; Reorganizing the message data, and performing feature extraction calculation on the reorganized message data to obtain a second feature value; Detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value; If the message data represented by the second characteristic value does not exist in the hash chain table corresponding to the first characteristic value, the message data is forwarded.

2. The method according to claim 1, characterized in that The received message data includes: receiving message data, and recording the time of receiving the message data; After detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the method further includes: If the message data represented by the second characteristic value exists in the hash chain table corresponding to the first characteristic value, determining a first time difference between the time of the message data and the time of the message data represented by the second characteristic value; If the first time difference is within the preset message deduplication time, the message data is discarded, and the time of the message data represented by the second characteristic value is updated to the time of receiving the message data.

3. The method according to claim 1, characterized in that The received message data includes: receiving message data, and recording the time of receiving the message data; After detecting whether the message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value, the method further includes: If the message data represented by the second characteristic value exists in the hash chain table corresponding to the first characteristic value, determining a first time difference between the time of the message data and the time of the message data represented by the second characteristic value; If the first time difference is not within the preset message deduplication time, the message data is forwarded, and the time of the message data represented by the second characteristic value is updated to the time of receiving the message data.

4. The method according to claim 1, wherein The received message data includes: receiving message data, and recording the time of receiving the message data; After forwarding the message data, the method further includes: The second characteristic value representing the message data and the time of receiving the message data are stored in a node in the hash linked table corresponding to the first characteristic value.

5. The method according to claim 4, characterized in that The step of storing the second characteristic value representing the message data and the time of receiving the message data in a node of the hash linked table corresponding to the first characteristic value includes: Detecting the number of nodes in the hash linked table corresponding to the first eigenvalue; If the number of nodes does not exceed the preset number of nodes in the hash linked table, the second characteristic value representing the message data and the time of receiving the message data are stored in a node in the hash linked table corresponding to the first characteristic value.

6. The method according to claim 4 or 5, characterized in that The method further comprises: Traversing each node in the overall hash chain list, and when traversing to a node, calculating the second time difference between the time when the message data stored in the node is stored and the time when the node is traversed; If the second time difference is not within the time corresponding to the preset node aging time, the traversed node is deleted.

7. The method according to claim 1, characterized in that The received message data includes: receiving message data, and recording the time of receiving the message data; The forwarding of the message data includes: Detecting the number of nodes in the hash linked table corresponding to the first eigenvalue; If the number of nodes exceeds the preset number of nodes in the hash linked table, the message data is forwarded.

8. A message forwarding device, characterized in that: The device comprises: a receiving unit, configured to receive message data and perform feature extraction calculation on the message data to obtain a first feature value; a reassembly unit, configured to reassemble the message data and perform feature extraction calculation on the reassembled message data to obtain a second feature value; A detection unit, configured to detect whether message data represented by the second characteristic value exists in the hash linked table corresponding to the first characteristic value; A forwarding unit is configured to forward the message data if the message data represented by the second characteristic value does not exist in the hash linked table corresponding to the first characteristic value.

9. An electronic device, characterized in that: It includes a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the method according to any one of claims 1 to 7 by calling the machine-readable instructions.

10. A machine-readable storage medium, characterized in that The machine-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, the method according to any one of claims 1 to 7 is implemented.