Data interaction method, node, terminal device and readable medium
By adding broadcast node list and update mechanism to the gossip broadcast protocol, the data interaction process is optimized, and the problem of slow convergence speed and message redundancy in poor connectivity networks is solved, achieving more efficient data propagation.
Patent Information
- Application Number
- CN202410327443.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-21
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-03-21
AI Technical Summary
In data broadcasting technology, the existing gossip broadcasting protocol converges slowly in networks with poor connectivity, and the pull mode may cause duplicate processing of messages, causing serious problem of message redundancy.
By adding a list of broadcast nodes to the message to be broadcast, selecting nodes that have not been broadcasted from the direct-connected nodes, updating the list of broadcast nodes and sending messages, ensuring that each node receives the latest broadcast node information, thereby avoiding repeated sending and repeated processing.
It improves the convergence speed of data interaction, reduces message redundancy, and solves the problem that the gossip broadcast protocol cannot take into account both convergence speed and message redundancy.
Smart Images

Figure CN118101360B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data interaction technology, and in particular, relates to a data interaction method, a node, a terminal device and a readable medium. Background Art
[0002] In data broadcast technology, the existing gossip broadcast protocol selects several directly connected nodes for broadcasting each time. However, in some networks with poor connectivity or extreme networks (such as networks with star network topology), the push mode (in data interaction, the data sender actively sends data to the data receiver) converges slowly and needs to use the pull mode (the data receiver actively pulls data from the data sender) to achieve convergence. However, in order to increase the convergence speed, the pull mode may lead to the problem of repeated message processing, resulting in serious message redundancy, and therefore has many shortcomings. Summary of the invention
[0003] The embodiments of the present application provide a data interaction method, a node, a terminal device and a readable medium, which can improve the convergence speed in the current data interaction process without increasing message redundancy.
[0004] In a first aspect, an embodiment of the present application provides a data interaction method, which is applied to a node; the data interaction method includes:
[0005] Determine the nodes to be broadcasted for this broadcast according to the first message to be broadcasted; the first message includes a list of broadcasted nodes;
[0006] Update the broadcasted node list according to the node information of the node to be broadcasted to obtain a second message;
[0007] Send the second message to the node to be broadcasted.
[0008] In an optional embodiment, the first message includes a range of nodes to be broadcast; and determining the nodes to be broadcasted for this broadcast according to the first message to be broadcast includes:
[0009] Determine, from directly connected nodes of the current node, nodes that are in the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes;
[0010] The nodes to be broadcasted for this broadcast are determined based on the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable nodes.
[0011] In an optional embodiment, determining the node to be broadcasted for this broadcast according to the broadcasted node list and the node information of the directly connected node of the broadcastable node includes:
[0012] The node with the largest number of directly connected nodes is selected from the broadcastable nodes as the node to be broadcasted for this broadcast.
[0013] In an optional embodiment, determining the node to be broadcasted for this broadcast according to the broadcasted node list and the node information of the directly connected node of the broadcastable node includes:
[0014] Searching for nodes that are not included in the broadcasted node list from the broadcastable nodes, and using the found nodes as candidate nodes;
[0015] Selecting a node whose directly connected nodes have no intersection with the directly connected nodes of the current node from the candidate nodes as a node to be broadcasted;
[0016] At least one node is selected from the candidate nodes that have not been selected as the nodes to be broadcasted as the node to be broadcasted.
[0017] In an optional embodiment, the first message is obtained by sending the other node; the method further includes:
[0018] receiving the first message;
[0019] The step of determining the nodes to be broadcasted for this broadcast according to the first message to be broadcasted includes:
[0020] Parsing the first message to obtain a broadcast range of the first message;
[0021] The nodes to be broadcasted are determined according to the broadcast range and the broadcasted node list.
[0022] In an optional embodiment, the data interaction method further includes:
[0023] Determine whether the current node is a node that receives the first message for the first time;
[0024] If not, merge the broadcasted node list with the node list corresponding to the first message in the message list currently being broadcast, and remove duplicate nodes after merging to obtain an updated broadcasted node list; replace the broadcasted node list in the first message with the updated broadcasted node list to generate a third message;
[0025] The third message, the node to be broadcasted, and the node information of the node to be broadcasted are added to a to-be-broadcast list.
[0026] In an optional embodiment, the first message is formed by an initial message to be broadcast generated by the node itself, and determining the node to be broadcast from the directly connected nodes according to the first message to be broadcast includes:
[0027] Determining a node to be broadcasted from the directly connected nodes according to a preset broadcast range of the initial message to be broadcasted;
[0028] The data interaction method further includes:
[0029] Update the node information of this node to an initial broadcast node list;
[0030] The broadcasted node list and the initial message to be broadcast are assembled to form the first message.
[0031] In an optional embodiment, determining the to-be-broadcasted node from the directly connected nodes according to the first message to be broadcast includes:
[0032] Reading a broadcasted node list in the first message, broadcastable node information corresponding to the first message, and directly connected node information of the broadcastable node information;
[0033] Searching for nodes that are not included in the broadcasted node list from the broadcastable nodes, and using the found nodes as candidate nodes;
[0034] Selecting a node whose directly connected nodes have no intersection with the directly connected nodes of the current node from the candidate nodes as a node to be broadcasted;
[0035] At least one node is selected from the candidate nodes that have not been selected as the nodes to be broadcasted as the node to be broadcasted.
[0036] In an optional embodiment, the sending a corresponding second message to the node to be broadcast includes:
[0037] Sort each node to be broadcasted to obtain the sending node sequence;
[0038] The corresponding second message is sent to the nodes to be broadcasted in sequence according to the sending node sequence.
[0039] In an optional embodiment, the data interaction method further includes:
[0040] If the current broadcast number of the second message is lower than the set broadcast number, determine the adjacent next broadcast node to be broadcasted from the directly connected nodes, update the list of broadcasted nodes in the second message, and send the second message to the adjacent next broadcast node to be broadcasted until the current broadcast number reaches the set broadcast number.
[0041] In a second aspect, an embodiment of the present application provides a data interaction node, including:
[0042] A to-be-broadcast node determination module determines the to-be-broadcast nodes for this broadcast according to a first message to be broadcast; the first message includes a list of broadcast nodes;
[0043] A second message generating module is configured to update the broadcast node list according to the node information of the node to be broadcasted, so as to obtain a second message;
[0044] The second message sending module sends the second message to the node to be broadcasted.
[0045] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described above when executing the computer program.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described above is implemented.
[0047] Beneficial effects of this application
[0048] The present application provides a data interaction method, node, terminal device and readable medium, which optimizes the gossip broadcast protocol, adds a list of broadcast nodes to the message to be broadcast, then selects the nodes that have not been broadcast from the directly connected nodes, and then sends a message with an updated list of broadcast nodes to the nodes that have not been broadcast, so that each node can know the currently broadcasted nodes when receiving the message, and can then choose to send messages only to the nodes that have not been broadcast, thereby reducing the probability of repeated transmission of the same node and improving the convergence speed. At the same time, since the message will not be processed repeatedly, the redundancy of the message is reduced, thereby solving the problem of the current gossip broadcast protocol that cannot take into account both the convergence speed and the message redundancy. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 This is a schematic diagram of the steps of a data interaction method provided by an embodiment of the present application;
[0051] Figure 2 This is provided by an embodiment of the present application Figure 1 Specific sub-step flow chart of step S1;
[0052] Figure 3 This is provided by an embodiment of the present application Figure 2Specific sub-step flow chart of step S111;
[0053] Figure 4 This is provided by an embodiment of the present application Figure 1 Specific sub-step flow chart of step S3;
[0054] Figure 5 This is a schematic diagram of the overall process of message broadcasting provided by an embodiment of the present application;
[0055] Figure 6 This is one of the flowcharts of the broadcast message receiving stage in the message broadcast provided by an embodiment of the present application;
[0056] Figure 7 This is the second flow chart of the phase of receiving broadcast messages in the message broadcast provided by one embodiment of the present application;
[0057] Figure 8 It is a flowchart of the stage of selecting nodes to be broadcasted in message broadcasting provided by an embodiment of the present application;
[0058] Fig. 9 It is a flowchart of the message broadcasting stage in the message broadcasting provided by an embodiment of the present application;
[0059] Fig.10 This is one of the network topology diagrams provided in one embodiment of the present application;
[0060] Fig.11 This is the second schematic diagram of the network topology structure provided by an embodiment of the present application;
[0061] Fig.12 It is a structural diagram of a data interaction node provided in an embodiment of the present application;
[0062] Fig.13 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0064] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0065] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0066] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0067] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0068] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0069] Currently, distributed networks can exchange data messages through the Gossip protocol, which is also called the Epidemic Protocol or the epidemic propagation algorithm. At present, the distributed data transmission process based on the Gossip protocol is initiated by the seed node. When a seed node has a state that needs to be updated to other nodes in the network, it will randomly select several surrounding nodes to spread the message. The nodes that receive the message will also repeat the process until all nodes in the network have received the message.
[0070] In the Gossip protocol, nodes will periodically and randomly select surrounding nodes to send messages, and the nodes that receive the messages will repeat this step. Therefore, it is inevitable that messages are sent repeatedly to the same node, causing message redundancy and increasing the processing pressure of the nodes that receive the messages. Moreover, since the messages are sent periodically, even nodes that have received the messages will repeatedly receive duplicate messages, increasing the redundancy of the messages.
[0071] Under the Gossip protocol, there are three ways of communication between two nodes in the network:
[0072] Push: Node A pushes the data (key, value, version) and the corresponding version number to node B, and node B updates the data in A that is newer than its own.
[0073] Pull: A pushes only the data key and version to B, B pushes the local data (Key, value, version) that is newer than A to A, and A updates the local data.
[0074] Push / Pull: Similar to Pull, but with one more step. A pushes local data that is newer than B to B, and B updates its local data.
[0075] In some networks with poor connectivity or extreme networks (such as networks with star network topology), the push mode converges slowly and requires the help of the pull mode to achieve convergence; to achieve the same convergence speed, the message redundancy is higher.
[0076] Based on this, Figure 1 As shown, an embodiment of the present application provides a data interaction method, which is applied to a node; the data interaction method includes:
[0077] S1: Determine the nodes to be broadcasted for this broadcast according to the first message to be broadcasted; the first message includes a list of broadcasted nodes.
[0078] It should be noted that the node in the embodiment of the present application is a terminal device in the distributed network, which will not be elaborated in this application.
[0079] In this step, the directly connected node can specifically be an adjacent node. In a distributed network, node 1 and node 2 are adjacent and directly connected to each other, so that node 2 is a directly connected node of node 1, and node 1 is a directly connected node of node 2. It should be understood that each node includes at least one directly connected node, that is, some nodes include only one directly connected node, and some nodes include multiple directly connected nodes.
[0080] In addition, it should be noted that this step is only for the step of broadcasting the message of the node executing the data interaction method. In the interaction of the message of the present application, the node broadcasts the message at least once, and each time a node to be broadcast is determined from the directly connected nodes. In the current gossip protocol, in the process of broadcasting multiple messages, the node to be broadcast is randomly selected, so there will be repeated sending of multiple messages to the same directly connected node.
[0081] S2: Update the broadcasted node list according to the node information of the node to be broadcasted to obtain a second message.
[0082] The first message and the second message of the present application both include message content to be broadcast. The difference lies in that the broadcast node lists of the first message and the second message are different. Specifically, the broadcast node list of the first message does not include the nodes to be broadcasted for this broadcast, while the broadcast node list of the second message includes the nodes to be broadcasted for this broadcast.
[0083] Exemplarily, the nodes to be broadcast this time are node 3, node 4 and node 5, the list of broadcast nodes in the first message includes node 1 and node 2, and the list of broadcast nodes in the second message includes node 1, node 2, node 3, node 4 and node 5, and the content of the broadcast message is consistent with the message content of the first message.
[0084] In this way, the present application updates the list of broadcast nodes at the data sending node, so that each time the data receiving node receives the second message, it will know the latest list of broadcast nodes, so that the broadcast nodes can be avoided in the subsequent selection of nodes to be broadcast. Compared with the current gossip protocol in which nodes to be broadcast are randomly selected or selected using a specific formula, the present application greatly reduces the number of nodes that are repeatedly received and processed by continuously updating the broadcast nodes, thereby reducing message redundancy.
[0085] It is further necessary to understand that, in the embodiment of the present application, the first message and the second message are relative concepts, that is, when the data sending node has not yet added the node to be broadcast to the list of broadcast nodes, it is the first message, and when the node to be broadcast is added to the list of broadcast nodes, the first message is transformed into the second message, and the second message is the first message of the data receiving node when sending data, which is not elaborated in the present application.
[0086] S3: Send the second message to the node to be broadcasted.
[0087] In this step, a second message is sent to the node to be broadcast. After the node to be broadcast receives the second message of this node, if this broadcast has not converged, the node to be broadcast uses the second message of this node as its first message, and then continues to update the list of broadcasted nodes, and sends its second message to other directly connected nodes, thereby continuously spreading and sending until this broadcast converges, that is, the set number of node broadcasts is met (for example, all nodes receive the message, or a preset number of nodes receive the node message, for example, 90% of the nodes receive the message and stop broadcasting, and 90% at this time means that this broadcast converges).
[0088] It can be seen that the data interaction method provided by the present application optimizes the gossip broadcast protocol, adds a list of broadcast nodes to the message to be broadcast, then selects the nodes that have not been broadcast from the directly connected nodes, and then sends a message to update the list of broadcast nodes to the nodes that have not been broadcast, so that each node can know the currently broadcasted nodes when receiving the message, and then can choose to send messages only to the nodes that have not been broadcast, thereby reducing the probability of repeated transmission of the same node and improving the convergence speed. At the same time, since the message will not be processed repeatedly, the redundancy of the message is reduced, thereby solving the problem of the current gossip broadcast protocol that cannot take into account both the convergence speed and the message redundancy.
[0089] It should be noted that the steps of the method of this application may be executed by a root node or a source node, or by a forwarding node, that is, the message content may be generated by the node itself, or it may be the message content received from other nodes, and this application does not impose any restrictions on this.
[0090] For a forwarding node, in a specific scenario, the node receives a message sent by an adjacent directly connected node and regards it as a first message, the first message includes a broadcast node list, and the broadcast node list includes its own node information. In this embodiment, the message also includes:
[0091] S011: Receive the first message.
[0092] The first message received in this embodiment is the second message sent by the adjacent directly connected "upper node". Specifically, the first message includes message content, message broadcast range and a list of broadcast nodes, and the list of broadcast nodes includes node information of this node.
[0093] Step S1, i.e., determining the nodes to be broadcasted for this broadcast according to the first message to be broadcasted, specifically includes:
[0094] S11: Parse the first message to obtain the broadcast range of the first message.
[0095] Specifically, the first message includes message content, message broadcast range and a list of broadcasted nodes. Generally speaking, the message can be structured data such as a message. The list of broadcasted nodes, message content and message broadcast range carried in the message are determined through preset structural parsing rules.
[0096] S12: According to the broadcast range and the broadcast node list, determine the nodes to be broadcasted.
[0097] Specifically, the broadcast range of the message includes which nodes the message can be broadcast to, for example, the range is from node 1 to node 100. Based on this broadcast range, assuming that the directly connected nodes of node 99 are node 98, node 100, node 103, and node 108, then the nodes to be broadcast determined by node 99 may be node 98 and node 100, or it may only be sent to node 98 or node 100, while node 103 and node 108 are not included as nodes to be broadcast.
[0098] In an optional embodiment, the first message is formed by the initial message to be broadcast generated by the own node, that is, the own node is the source node, and the first message is broadcasted from the own node. At this time, step S1, that is, determining the node to be broadcast from the directly connected nodes according to the first message to be broadcast, includes: determining the node to be broadcast from the directly connected nodes according to the preset broadcast range of the initial message to be broadcast. Since the own node is the source node, the broadcast range of the first message is the initial preset broadcast range, so the node to be broadcast can be determined according to the preset broadcast range and the node directly connected to the source node. In this embodiment, the data interaction method also includes:
[0099] S021: Update the node information of the current node to an initial broadcast node list;
[0100] Since this node is the source node, the initial broadcast node list includes this node.
[0101] S022: Assemble the broadcasted node list and the initial message to be broadcast to form the first message.
[0102] In this embodiment, since the node is a source node, the first message is assembled by the content of the initial message to be broadcast, the preset broadcast range, and the broadcast list formed by the node.
[0103] Exemplarily, for an embodiment in which this node is a source node, the specific process is to first receive the newly generated message content that needs to be broadcast by this node, and receive the broadcast range of this message; then, based on the broadcast range, filter out the broadcastable nodes directly connected to this node, and carry the node information of these nodes; then, based on the above content, assemble a broadcast message, and the list of broadcasted nodes carried in the message includes this node; finally, put the assembled broadcast message, the selected broadcastable nodes, and the node information of these nodes into the list to be broadcast, wait for the broadcast to be processed, and add the message to the list of messages being broadcast.
[0104] In an optional embodiment, in order to avoid repeated reception of messages and reduce message redundancy caused by repeated reception and repeated processing of messages, the present application can exclude repeated processing of messages by determining whether the first message is received for the first time. In this embodiment, Figure 4 As shown, the data interaction method also includes:
[0105] S031: Determine whether this node is the node that receives the first message for the first time.
[0106] Specifically, it is possible to determine whether the message has been broadcast and whether it does not exist in the list of messages being broadcast. If so, the received broadcast message, the selected broadcastable nodes, and the direct connection information of these nodes are put into the list to be broadcast, waiting for the broadcast to be processed, and the message is added to the list of messages being broadcast.
[0107] S032: If not, merge the broadcasted node list with the node list corresponding to the first message in the message list currently being broadcast, and remove duplicate nodes after merging to obtain an updated broadcasted node list; replace the broadcasted node list in the first message with the updated broadcasted node list to generate a third message.
[0108] If not, it means that the message is not received for the first time. ① The broadcasted nodes carried in this message can be merged and deduplicated with the broadcasted nodes of this message in the message list being broadcast. Then ② the updated broadcast message, the selected broadcastable nodes and the direct connection information of these nodes are put into the list to be broadcast, waiting for the broadcast to be processed, and the list of broadcasted nodes of this message in the message list being broadcast is updated. Since the list of broadcasted nodes in the updated message is different, the assembled message is defined as the third message. It should be understood that the difference between the third message, the first message and the second message lies only in the difference in the list of broadcasted nodes, which will not be elaborated here.
[0109] For example, the list of broadcast nodes in the message is: n1, n2, n3; the list of broadcast nodes of this message in the message list being broadcast is: n2, n3, n5. Then after deduplication and merging, the updated list of broadcast nodes is: n1, n2, n3, n5.
[0110] S033: Add the third message, the node to be broadcast, and the node information of the node to be broadcast to a list to be broadcast.
[0111] Specifically, in this step, after the message is put into the to-be-broadcast list, the messages in the to-be-broadcast list are traversed, a to-be-broadcast node is selected for each message, and the message is broadcast.
[0112] It should be understood that, for each node, the message list being broadcast may include multiple different messages, and this application does not impose any limitation on this.
[0113] The further preferred concepts of the present application are described in detail below.
[0114] In order to improve the broadcast efficiency, the present application further designs the list of broadcast nodes. Specifically, step S1 of the present application is to determine the nodes to be broadcasted according to the first message to be broadcasted, such as Figure 2 As shown, specifically including:
[0115] S110: Determine, from directly connected nodes of the current node, nodes that are in the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes.
[0116] Specifically, since the first message includes the message content, the message broadcast range and the list of broadcasted nodes, it is possible to determine whether all directly connected nodes of this node can be broadcasted based on the message broadcast range. At the same time, combined with the list of broadcasted nodes, it is possible to know the nodes that have been broadcasted among the broadcastable directly connected nodes, and then eliminate them, and treat the nodes that have not been broadcasted as broadcastable nodes.
[0117] It should be understood that the broadcastable nodes in the present application are not the nodes to be broadcasted. The difference is that the broadcastable nodes are nodes that are eligible for broadcasting. However, in each message broadcast, not all nodes that are eligible for broadcasting will be selected. Instead, some of them are selected as the nodes for this broadcast, and the remaining nodes are selected in subsequent message broadcasts. The number of selections and the number of selections are determined according to the network conditions and network characteristics, which will not be elaborated here. The nodes to be broadcasted are the nodes that are ready to be broadcasted this time. Obviously, the nodes to be broadcasted are selected from the broadcastable nodes.
[0118] S111: Determine the nodes to be broadcasted for this broadcast according to the broadcasted node list and the node information of the directly connected nodes of the broadcastable nodes.
[0119] Specifically, a broadcastable node is a directly connected node of the current node, and a directly connected node of a broadcastable node means a node to which the current node is secondarily connected. For example, node 1 is directly connected to node 2, and node 2 is a broadcastable node, and node 3 is directly connected to node 2. In this case, node 3 is a "directly connected node of a broadcastable node", node 2 is a "broadcastable node", and node 1 is the current node.
[0120] In a preferred embodiment of the present application, in order to improve the broadcast efficiency, the broadcast of the message can be arranged based on the number of directly connected nodes of the broadcastable node. Specifically, since the same message may be broadcast multiple times in the broadcastable nodes, some of the nodes are selected each time, resulting in a time sequence in the broadcast of the nodes. Based on this feature, the inventor of the present application gives priority to the broadcastable nodes with a large number of directly connected nodes as the nodes to be broadcasted. Specifically, for the current message broadcast, the nodes to be broadcasted for this broadcast are determined based on the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable nodes, including: selecting the node with the largest number of directly connected nodes from the broadcastable nodes as the node to be broadcasted for this broadcast.
[0121] In this embodiment, for the current message broadcast, the node with the largest number of directly connected nodes is always selected from the broadcastable nodes as the node to be broadcasted for this broadcast. Therefore, the node to be broadcasted has the largest number of directly connected nodes during each message broadcast. That is, the broadcastable nodes with more directly connected nodes have higher broadcast priority and can receive messages earlier, thereby giving priority to broadcasting to their own directly connected nodes. Since they have the largest number of directly connected nodes, their propagation range is wider, and they can converge faster.
[0122] For example, Fig.10 In the network topology shown, when node 1 generates a message for broadcasting, since node 2's directly connected nodes include node 3 and node 4, and node 2 has the largest number of directly connected nodes compared to node 5, node 6, and node 7, node 2 will be selected first for broadcasting, and then several nodes will be randomly selected from connected nodes 5, node 6, and node 7 for broadcasting. This ensures that when entering the network through node 2, nodes 3, node 4, and node 8 can receive the broadcast message as early as possible, so that it can be propagated to the entire network faster, thereby improving the broadcast efficiency and achieving faster convergence.
[0123] In order to further reduce the redundancy of message reception and processing, in the embodiment of the present application, step S111, that is, determining the nodes to be broadcasted for this broadcast according to the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable nodes, such as Figure 3 As shown, it may include:
[0124] S1110: Searching for nodes that are not included in the broadcasted node list from the broadcastable nodes, and taking the searched nodes as candidate nodes.
[0125] S1111: Select a node from the candidate nodes whose directly connected nodes have no intersection with the directly connected nodes of the current node as a node to be broadcasted.
[0126] This embodiment selects directly connected nodes without intersection for priority broadcasting, which is equivalent to preferentially broadcasting to nodes with the greatest influence in the network architecture (ie, with more directly connected nodes), so that broadcast convergence can be completed as soon as possible, thereby improving the convergence speed.
[0127] Furthermore, the present application can also randomly select some nodes from the nodes not selected in step S1111, thereby expanding the broadcast range. Figure 3 As shown, the present application further includes:
[0128] S1112: Select at least one node from the candidate nodes that have not been selected as the nodes to be broadcast as the node to be broadcast.
[0129] This embodiment selects at least one node as a node to be broadcasted from the candidate nodes that have not been selected as nodes to be broadcasted, thereby avoiding the situation where the number of nodes broadcasted at a single time is too small, and the number of broadcasts can be reduced.
[0130] For example, Fig.11 The network topology structure diagram shown in FIG. 1 is a schematic diagram of a network topology structure. In this embodiment, based on the concept of combining the candidate nodes, the broadcasting steps are as follows:
[0131] 1. When node 1 generates a message for broadcast, because the nodes directly connected to node 2 (node 3, node 4, node 8) have no intersection with the nodes directly connected to this node (node 2, node 5, node 6, node 7), node 2 will be selected as the node to be broadcast first, and then node 5 and node 6 will be randomly selected as the nodes to be broadcast. The broadcast message sent by node 1 to node 2, node 5, and node 6 carries a list of broadcasted nodes including node 1, node 2, node 5, and node 6.
[0132] 2. When node 5 receives the message broadcast by node 1, it will know that the directly connected nodes (node 1 and node 6) are in the list of broadcast nodes, so it will not broadcast again, reducing message redundancy.
[0133] 3. When node 6 receives the message broadcast by node 1, it will know that the directly connected nodes (node 1 and node 5) are in the list of broadcast nodes, while the directly connected node (node 7) is not in the list of broadcast nodes. Therefore, node 6 will select node 7 as the node to be broadcast. In the message broadcast by node 6 to node 7, the list of broadcast nodes carried includes node 1, node 2, node 5, node 6, and node 7.
[0134] 4. When node 2 receives the message broadcast by node 1, it will know that the directly connected nodes (node 3, node 4) are no longer in the broadcast list, and the nodes directly connected to node 2 (node 1, node 3, node 4) have no intersection with the directly connected nodes of node 3 (node 2, node 8) and the directly connected nodes of node 4 (node 2). Therefore, node 3 and node 4 will be selected as the nodes to be broadcasted. The broadcast node list carried in the broadcast message sent by node 2 to node 3 and node 4 includes node 1, node 2, node 5, node 6, node 3, and node 4.
[0135] 5. After node 7 receives the message broadcast by node 6, it finds that all directly connected nodes are in the list of broadcast nodes, so it stops broadcasting.
[0136] 6. After receiving the message broadcast by node 2, node 4 finds that all directly connected nodes are in the list of broadcast nodes, so it stops broadcasting.
[0137] 7. After receiving the message broadcast by node 2, node 3 knows that the directly connected node 8 is not in the list of broadcast nodes, so it selects node 8 as the node to be broadcast. The list of broadcast nodes carried in the broadcast message sent by node 3 to node 8 includes node 1, node 2, node 5, node 6, node 3, node 4, and node 8.
[0138] 8. After node 8 receives the message broadcast by node 3, it finds that all directly connected nodes are in the list of broadcast nodes, so it stops broadcasting.
[0139] Through the above embodiment, since the nodes directly connected to the candidate node list have no intersection with the nodes directly connected to the current node, the nodes selected for broadcasting, i.e., the nodes to be broadcasted, can be broadcasted first by selecting the directly connected nodes without intersection. The directly connected nodes without intersection are equivalent to the "seeds" of another "broadcast circle", thereby achieving the effect of giving priority to broadcasting the nodes with the largest influence range, which is conducive to rapid convergence, for example Fig.11Node 2 is the node with priority broadcasting. Node 2 affects nodes 3, 4 and 8. Therefore, node 2 acts as the seed of the "broadcast circle" and "infects" nodes 3, 4 and 8. If node 1 broadcasts nodes 5, 6, 7 for the first time and node 2 for the second time, nodes 5, 6, 7 have been processed, and nodes 2, 3, 4 and 8 begin to be "infected", resulting in a decrease in the overall speed. Similarly, through the above method, node 2 preferentially "infects" node 3, and the infection time of node 8 and node 4 is not much different. If node 4 is infected first, node 4 ends, while node 8 has not been infected yet, and it takes another broadcast time. It can be seen that the convergence speed can be improved through this embodiment.
[0140] It can be understood that the above embodiment of the present application describes the scenario of a single message broadcast. Specifically, in actual broadcasting, for the same message, multiple message broadcasts can be performed. For example, assuming that it needs to be broadcast to nodes 1 to 100, node 1 broadcasts to nodes 2 and 3 for the first time, and broadcasts to nodes 4 and 5 for the second time (assuming that nodes 2 to 5 are directly connected nodes of node 1). At this time, for a single broadcast, the broadcasts can be performed in sequence. In this embodiment, the sending of the corresponding second message to the node to be broadcast includes:
[0141] S31: sort each node to be broadcasted to obtain a sending node sequence;
[0142] The sending node sequence includes the sending order of the nodes. For example, in the first broadcast of node 1 above, the message is broadcast to nodes 2 and 3, so the sending node sequence can be: 1, node 2; 2, node 3.
[0143] S32: Send the corresponding second message to the nodes to be broadcasted in sequence according to the sending node sequence.
[0144] In addition, for multiple message broadcasts, the present application can perform multiple broadcasts in an iterative manner, and set the trigger condition for the iteration to whether the number of broadcasts meets the set number of broadcasts. It should be understood that the set number of broadcasts can be determined based on parameters such as distributed network characteristics. Optionally, the set number of broadcasts can be stored in the memory of the node sending the message through a configuration file. This application does not impose any restrictions on this.
[0145] In an optional embodiment, multiple broadcasts are performed in an iterative manner, and the data interaction method also includes: if the current broadcast number of the second message is lower than the set broadcast number, determining the adjacent node to be broadcasted for the next broadcast from the directly connected nodes, updating the list of broadcasted nodes in the second message, and sending the second message to the adjacent node to be broadcasted for the next broadcast until the current broadcast number reaches the set broadcast number.
[0146] Specifically, it can be determined whether the number of times the message is broadcast is sufficient. If the number of times the message is broadcast is sufficient, the message is removed from the message list being broadcast, and the record of the message that has been broadcast is updated. If the number of times the message is broadcast is insufficient, the list of broadcast nodes of the message in the message list being broadcast is updated.
[0147] In order to explain the present application more clearly, the present application shows examples of the processes at various stages during the broadcasting process.
[0148] Overall process
[0149] like Figure 5 As shown, the prerequisite is that each node knows the directly connected node information of its adjacent directly connected nodes in the network. The overall process includes:
[0150] 1) The node receives a gossip broadcast message sent by other nodes in the network, which carries a list of nodes to which the message has been broadcast (in other embodiments, the gossip broadcast message of the node may be a new message generated by the node that needs to be broadcast).
[0151] 2) The node selects the node to be broadcast based on the list of nodes that have been broadcasted carried in the message and the directly connected node information of the adjacent directly connected nodes known to the current node.
[0152] 3) The node adds the selected nodes to be broadcasted to the list of nodes that have been broadcasted in the message, and broadcasts the message to these nodes to be broadcasted.
[0153] Receiving broadcast messages
[0154] like Figure 6 and Figure 7 As shown, the broadcast message may be a message newly generated by the node and needs to be broadcasted, or a broadcast message sent by other nodes.
[0155] 1) If the broadcast message is a new message generated by this node and needs to be broadcast, such as Figure 6 As shown, the process is as follows:
[0156] 1. Retrieve the newly generated message content to be broadcast from the memory of this node, and retrieve the broadcast range of this message;
[0157] 2. According to the broadcast range, filter out the broadcastable nodes that the node is directly connected to, and carry the directly connected node information of these nodes;
[0158] 3. Based on the above content, assemble a broadcast message, and the list of broadcast nodes carried in the message includes this node;
[0159] 4. Put the assembled broadcast message, the selected broadcastable nodes and the direct connection information of these nodes into the list to be broadcasted, wait for the broadcast to be processed, and add the message to the list of messages being broadcasted.
[0160] 2) If the broadcast message is received from other nodes, such as Figure 7 As shown, the process is as follows:
[0161] 1. Receive broadcast messages from other nodes, which carry a list of broadcast nodes;
[0162] 2. Check if the message has been broadcasted. If yes, skip the process. Otherwise, proceed to the next step.
[0163] 3. Parse the broadcast message and obtain the broadcast range of the broadcast message;
[0164] 4. According to the broadcast range, filter out the broadcastable nodes that the node is directly connected to, and carry the directly connected node information of these nodes;
[0165] 5. Determine whether this message is received for the first time, that is, whether this message has been broadcast and does not exist in the list of messages being broadcast;
[0166] (1) If yes, the received broadcast message, the selected broadcastable nodes and the direct connection information of these nodes are put into the list to be broadcasted, waiting for the broadcast to be processed, and the message is added to the list of messages being broadcasted;
[0167] (2) If not, ① merge the broadcasted nodes carried in this message with the broadcasted nodes of this message in the message list being broadcasted, and remove duplicates. ② put the updated broadcast message, the selected broadcastable nodes, and the direct connection information of these nodes into the list to be broadcasted, wait for the broadcast to be processed, and update the list of broadcasted nodes of this message in the message list being broadcasted.
[0168] After putting the message into the to-be-broadcast list, traverse the messages in the to-be-broadcast list, select a to-be-broadcast node for each message, and broadcast the message.
[0169] Select the node to be broadcasted
[0170] like Figure 8 As shown, the process of selecting a node to be broadcast for a message in the list to be broadcast is as follows:
[0171] 1. Get a list of all directly connected nodes of this node;
[0172] 2. Read the broadcastable node information and directly connected node information of these nodes carried in the message, and the broadcasted node list information carried in the broadcast message;
[0173] 3. Find the node list information included in the broadcastable node information list but not included in the broadcasted node list carried in the message as the candidate node list;
[0174] 4. Find a node in the candidate node list whose directly connected nodes have no intersection with the nodes directly connected to this node, and select it as the node to be broadcasted;
[0175] 5. Randomly select several nodes from the candidate node list that have not been selected as nodes to be broadcasted, and also select them as nodes to be broadcasted;
[0176] 6. The node list selected in the above manner is used as the node list to be broadcasted by this node for this message, that is, the node list to be broadcasted.
[0177] Message Broadcast
[0178] like Fig. 9 As shown in the figure, after the message in the to-be-broadcast list selects the to-be-broadcast node, the process of message broadcasting is as follows:
[0179] 1. Add the selected nodes to be broadcast to the list of broadcast nodes carried in the message and remove duplicates;
[0180] 2. Re-serialize the messages and send them to the nodes to be broadcast one by one;
[0181] 3. Update the number of times the message is broadcast;
[0182] 4. Determine whether the number of times the message is broadcast is sufficient;
[0183] (1) If the message has been broadcast enough times, remove the message from the list of messages being broadcast and update the record of messages that have been broadcast;
[0184] (2) If it is insufficient, update the broadcast node list information of the message in the message list being broadcast.
[0185] It can be seen from the above stages that this application solves the problem that the current gossip broadcast protocol cannot take into account both convergence speed and message redundancy.
[0186] The following is a detailed description of a data interaction node provided in an embodiment of the present application. The data interaction node is a data sending node, such as Fig.12 As shown, the data interaction node includes:
[0187] The to-be-broadcasted node determination module 1 determines the to-be-broadcasted nodes for this broadcast according to the first message to be broadcast; the first message includes a list of broadcasted nodes;
[0188] A second message generating module 2 updates the broadcast node list according to the node information of the node to be broadcasted to obtain a second message;
[0189] The second message sending module 3 sends the second message to the node to be broadcasted.
[0190] It can be seen that based on the detailed description of the above method step embodiments, the data interaction node provided by the present application reduces the probability of repeated transmission of the same node and improves the convergence speed. At the same time, since the messages will not be processed repeatedly, the redundancy of the messages is reduced, thereby solving the problem of the current gossip broadcast protocol that cannot take into account both the convergence speed and the message redundancy.
[0191] Based on the same inventive concept, in an optional embodiment, the to-be-broadcasted node determination module includes:
[0192] A range determination unit, which determines, from directly connected nodes of the current node, nodes that are in the range of nodes to be broadcasted and are not in the list of broadcasted nodes as nodes that can be broadcasted;
[0193] The to-be-broadcasted node determination unit determines the to-be-broadcasted node for this broadcast according to the broadcasted node list and the node information of the directly connected node of the broadcastable node.
[0194] Based on the same inventive concept, in an optional embodiment, the to-be-broadcast node determination unit is specifically configured to select a node with the largest number of directly connected nodes from the broadcastable nodes as the to-be-broadcast node for this broadcast.
[0195] Based on the same inventive concept, in an optional embodiment, the to-be-broadcasted node determination unit specifically includes:
[0196] a candidate node determination unit, searching for nodes that are not included in the broadcasted node list from the broadcastable nodes, and using the found nodes as candidate nodes;
[0197] An intersection determination unit selects, from the candidate nodes, nodes whose directly connected nodes have no intersection with the directly connected nodes of the current node as nodes to be broadcasted;
[0198] Based on the same inventive concept, in an optional embodiment, the to-be-broadcasted node determination unit further includes:
[0199] The selection unit selects at least one node as the node to be broadcast from the candidate nodes that have not been selected as the node to be broadcast.
[0200] Based on the same inventive concept, in an optional embodiment, the first message is sent by the other node; the data interaction node further includes:
[0201] A receiving module, receiving the first message;
[0202] The module for determining nodes to be broadcast includes:
[0203] A parsing unit, parsing the first message to obtain a broadcast range of the first message;
[0204] The determining unit determines the nodes to be broadcasted according to the broadcast range and the broadcasted node list.
[0205] Based on the same inventive concept, in an optional embodiment, the data interaction node further includes:
[0206] A judgment module, judging whether the current node is a node that receives the first message for the first time;
[0207] If not, the update module merges the broadcast node list with the node list corresponding to the first message in the message list currently being broadcast, and removes the duplicate nodes after merging to obtain an updated broadcast node list; replaces the broadcast node list in the first message with the updated broadcast node list to generate a third message;
[0208] An adding module is configured to add the third message, the node to be broadcasted, and the node information of the node to be broadcasted to a list to be broadcasted.
[0209] Based on the same inventive concept, in an optional embodiment, the first message is formed by an initial message to be broadcast generated by the node itself, and the node to be broadcast determining module is specifically used to determine the node to be broadcast from the directly connected nodes according to a preset broadcast range of the initial message to be broadcast;
[0210] The data interaction node also includes:
[0211] A node update module updates the node information of the node to an initial broadcast node list;
[0212] An assembling module assembles the broadcasted node list and the initial message to be broadcast to form the first message.
[0213] Based on the same inventive concept, in an optional embodiment, the second message sending module includes:
[0214] The sorting unit sorts each node to be broadcasted to obtain a sending node sequence;
[0215] The second message sending unit sends the corresponding second message to the nodes to be broadcasted in sequence according to the sending node sequence.
[0216] Based on the same inventive concept, in an optional embodiment, the data interaction node further includes:
[0217] Iterate the broadcast unit, if the current broadcast number of the second message is lower than the set broadcast number, determine the adjacent next broadcast node to be broadcasted from the directly connected nodes, update the broadcasted node list in the second message, and send the second message to the adjacent next broadcast node to be broadcasted until the current broadcast number reaches the set broadcast number.
[0218] In addition, the present application further provides a distributed network system, which may be a blockchain system or other distributed network systems, and the present application does not impose any restrictions on this.
[0219] Specifically, the distributed network system includes multiple nodes, each of which can be a sending node or a receiving node. When the data interaction node is a sending node, the above steps of the present application are executed. When the data interaction node is a receiving node, it receives the message sent by the previous sending node, and then becomes a sending node to forward the message until the broadcast converges.
[0220] Fig.13 A schematic diagram of a terminal device provided in an embodiment of the present application. The terminal device 400 includes: at least one processor 401 ( Fig.13 Only one processor is shown in the figure), a memory 402, and a computer program 403 stored in the memory 402 and executable on the at least one processor 401, wherein the processor 401 implements the steps in the above method embodiment when executing the computer program 403.
[0221] The terminal device 400 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Fig.13 It is only an example of the terminal device 400 and does not constitute a limitation on the terminal device 400. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0222] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0223] In some embodiments, the memory 402 may be an internal storage unit of the terminal device 400, such as a hard disk or memory of the terminal device 400. In other embodiments, the memory 402 may also be an external storage device of the terminal device 400, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device 400. Further, the memory 402 may also include both an internal storage unit of the terminal device 400 and an external storage device. The memory 402 is used to store an operating system, an application program, a boot loader (Boot Loader), data and other programs, such as the program code of the computer program, etc. The memory 402 may also be used to temporarily store data that has been output or is to be output.
[0224] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0225] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0226] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0227] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0228] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0229] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0230] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0231] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0232] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data interaction method, characterized in that: The data interaction method is applied to a node; the data interaction method comprises: Determine the nodes to be broadcasted for this broadcast according to the first message to be broadcasted; the first message includes a list of broadcasted nodes; Update the broadcasted node list according to the node information of the node to be broadcasted to obtain a second message; Sending the second message to the node to be broadcasted; The first message includes a range of nodes to be broadcast; and determining the nodes to be broadcasted for this broadcast according to the first message to be broadcast includes: Determine, from directly connected nodes of the current node, nodes that are in the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes; Determine the nodes to be broadcasted for this broadcast based on the list of broadcasted nodes and the node information of directly connected nodes of the broadcastable nodes; The determining the nodes to be broadcasted for this broadcast according to the broadcasted node list and the node information of the directly connected nodes of the broadcastable nodes includes: Searching for nodes that are not included in the broadcasted node list from the broadcastable nodes, and using the found nodes as candidate nodes; Selecting a node whose directly connected nodes have no intersection with the directly connected nodes of the current node from the candidate nodes as a node to be broadcasted; According to the broadcast node list and Can The node information of the directly connected nodes of the broadcast node determines the nodes to be broadcasted for this broadcast, and also includes: At least one node is selected from the candidate nodes that have not been selected as the nodes to be broadcasted as the node to be broadcasted.
2. The data interaction method according to claim 1, characterized in that: The first message is obtained by sending from other nodes; The data interaction also includes: receiving the first message; The step of determining the nodes to be broadcasted for this broadcast according to the first message to be broadcasted includes: Parsing the first message to obtain a broadcast range of the first message; The nodes to be broadcasted are determined according to the broadcast range and the list of broadcasted nodes.
3. The data interaction method according to claim 2, characterized in that: The data interaction method further includes: Determining whether the node receives the first message for the first time; If not, merge the broadcasted node list with the node list corresponding to the first message in the message list currently being broadcast, and remove duplicate nodes after merging to obtain an updated broadcasted node list; replace the broadcasted node list in the first message with the updated broadcasted node list to generate a third message; The third message, the node to be broadcasted, and the node information of the node to be broadcasted are added to a list of messages to be broadcasted.
4. The data interaction method according to claim 1, characterized in that: The first message is formed by an initial message to be broadcast generated by the node itself, and determining the node to be broadcast from the directly connected nodes according to the first message to be broadcast includes: Determining a node to be broadcasted from the directly connected nodes according to a preset broadcast range of the initial message to be broadcasted; The data interaction method further includes: Update the node information of this node to the initial broadcast node list; The broadcasted node list and the initial message to be broadcast are assembled to form the first message.
5. The data interaction method according to claim 1, characterized in that: The data interaction method further includes: If the current broadcast number of the second message is lower than the set broadcast number, determine the adjacent next broadcast node to be broadcasted from the directly connected nodes, update the list of broadcasted nodes in the second message, and send the second message to the adjacent next broadcast node to be broadcasted until the current broadcast number reaches the set broadcast number.
6. A data interaction node, characterized in that: include: A to-be-broadcasted node determination module determines the to-be-broadcasted nodes for this broadcast according to the first message to be broadcasted; The first message includes a broadcasted node list; A second message generating module is configured to update the broadcast node list according to the node information of the node to be broadcasted, so as to obtain a second message; A second message sending module, sending the second message to the node to be broadcasted; The first message includes a range of nodes to be broadcasted, and the module for determining nodes to be broadcasted includes: A range determination unit, which determines, from directly connected nodes of the current node, nodes that are in the range of nodes to be broadcasted and are not in the list of broadcasted nodes as nodes that can be broadcasted; The to-be-broadcast node determination unit determines the to-be-broadcast node for this broadcast according to the broadcast node list and the node information of the directly connected nodes of the broadcastable node; The node to be broadcasted determining unit specifically includes: A candidate node determination unit searches for nodes that are not included in the broadcast node list from the broadcastable nodes, and uses the searched nodes as candidate nodes; An intersection determination unit selects, from the candidate nodes, nodes whose directly connected nodes have no intersection with the directly connected nodes of the current node as nodes to be broadcasted; The node to be broadcasted determining unit further includes: The selection unit selects at least one node as the node to be broadcast from the candidate nodes that have not been selected as the node to be broadcast.
7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the data interaction method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Management method for forwarding of broadcast message in embedded wireless ad hoc network
CN105072586A
Broadcast convergence alliance chain P2P networking method and device and readable storage medium
CN112565395A
Message broadcasting method and device, computer equipment and storage medium
CN114024786A
Message broadcasting method and device
CN116248594A
Message broadcasting method and device
CN116319827A
