CN103684738B - A kind of method and device of preventing interference of original message - Google Patents
A kind of method and device of preventing interference of original message Download PDFInfo
- Publication number
- CN103684738B CN103684738B CN201310750769.0A CN201310750769A CN103684738B CN 103684738 B CN103684738 B CN 103684738B CN 201310750769 A CN201310750769 A CN 201310750769A CN 103684738 B CN103684738 B CN 103684738B
- Authority
- CN
- China
- Prior art keywords
- time
- message
- former message
- former
- node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Computer And Data Communications (AREA)
Abstract
The invention provides a kind of method and device of preventing interference of original message, by selecting the CPU counter time as the chronograph mechanism between node and the agreement using preventing interference of original message, avoid the dependence to time synchronized software between node, the scheme that alternative existing timestamp and time synchronized are combined, eliminate the dependence to time synchronized software, and deployment cost and the clock hardware requirement of distributed system are reduced, effectively eliminate the problem of former message interference.
Description
Technical field
The present invention relates to communication technical field, more particularly to a kind of method and device of preventing interference of original message.
Background technology
In existing distributed system, a plurality of network channel is generally used between node, realize concurrent transmission to lift network
Transmission performance, and strengthen the robustness of network transmission.
In a kind of distributed system, when client is needed the data is activation of specified page to data server, need
Message is sent to data server, to notify that data server processes the data of specified page.If message sends time-out, will
The data of specified page are resend, due in the interval that message twice sends, it is allowed to which the data of specified page are updated, institute
May be updated relative to the data of identical specified page in former message with the data for retransmitting specified page in message, caused
Content is different.In this case, for data server, it is not allowed for after re-transmission message is received, then reception processing
Former message, will otherwise cause former message covering to retransmit message;But data server is allowed after former message is received, then receives weight
Pass message.
Due to former message can be caused to be received after message is retransmitted using the exception of a plurality of network channel, network channel,
Trigger former message interference problem.In order to avoid the problem, the method being generally combined using timestamp and time synchronized at present, tool
Body scheme is:Time synchronized software is disposed on each node of distributed system, each time synchronization between nodes are realized;Node is being received
After message, the expired time (the transmission timestamp of message adds message time-out time) of message is calculated, and when local with receiving terminal
Between compare, if it is determined that message is expired, abandon the message.Sent after former message time-out due to retransmitting message, if receiving terminal
Former message is received after re-transmission message is received, in view of time synchronization between nodes, must can determine that former message is expired and abandons,
So as to avoid former message interference problem.
The scheme that the timestamp and time synchronized of existing use are combined, will dispose on each node of distributed system
Time synchronized software, deployment cost is higher, and requires that the clock frequency of each node of distributed system is completely the same, to hardware requirement
It is higher, once the clock frequency of part of nodes goes wrong, it is necessary to enter row clock synchronization process, mainly include two kinds of situations:1)
Nodal clock is adjusted forward by synchronous impact, can cause receive other nodes stale messages (before the time adjust cause decision message not
It is expired), so as to cause former message to disturb;2) nodal clock is adjusted backward by synchronous impact, for the node of standard time clock, should
The former message and the time interval of re-transmission message that node sends do not reach timeouts, cause other nodes accurately to judge
Whether the message that the node sends is expired, and then triggers former message interference problem.
The content of the invention
The present invention is regarding to the issue above, it is proposed that a kind of method and device of preventing interference of original message, alternative existing time
The scheme that stamp and time synchronized are combined, eliminates the dependence to time synchronized software, and reduce the deployment cost of distributed system
With clock hardware requirement, the problem of former message interference is effectively eliminated.
In one aspect, the invention provides a kind of method of preventing interference of original message, it includes:
Former message is received, when in the former message comprising the transmission former message during the current CPU counter of sending node
Between with the former message time-out when the corresponding sending node CPU counter time;
According to the current CPU counter time of the sending node in rear message received after the former message, institute is judged
Whether overtime state former message, however, it is determined that the former message time-out, then abandon the former message;Otherwise, the former message is received.
In another aspect, the invention provides a kind of preventing interference of original message device, it includes:
Receiving unit, for receiving former message, sending node works as when in the former message comprising the transmission former message
Corresponding sending node CPU counter time when preceding CPU counter time and the former message time-out;
Processing unit, for being counted according to the current CPU of the sending node in rear message received after the former message
The device time, judge whether the former message is overtime, however, it is determined that the former message time-out, then abandon the former message;Otherwise, receive
The former message.
The invention provides a kind of method and device of preventing interference of original message, section is used as by selecting the CPU counter time
Chronograph mechanism and preventing interference of original message agreement between point, it is to avoid the dependence between node to time synchronized software, it is alternative existing
The scheme that timestamp and time synchronized are combined, eliminates the dependence to time synchronized software, and reduce the deployment of distributed system
Cost and clock hardware requirement, effectively eliminate the problem of former message interference.
Brief description of the drawings
Specific embodiment of the invention is described below with reference to accompanying drawings, wherein:
Fig. 1 is a kind of method flow diagram of preventing interference of original message provided in an embodiment of the present invention.
Fig. 2 is that node when a kind of method interior joint of preventing interference of original message provided in an embodiment of the present invention is actively connected is opened
Life cycle establishes flow chart when dynamic.
Fig. 3 is that node when a kind of method interior joint of preventing interference of original message provided in an embodiment of the present invention is passively connected is opened
Life cycle establishes flow chart when dynamic.
Fig. 4 be a kind of preventing interference of original message provided in an embodiment of the present invention method in preventing interference of original message protocol processes stream
Cheng Tu.
Fig. 5 is a kind of schematic diagram of preventing interference of original message device provided in an embodiment of the present invention.
Specific embodiment
In order that technical scheme and advantage become more apparent, below in conjunction with accompanying drawing to of the invention exemplary
Embodiment is described in more detail, it is clear that described embodiment is only a part of embodiment of the invention, rather than
The exhaustion of all embodiments.
As shown in figure 1, the embodiment of the invention provides a kind of method of preventing interference of original message, it comprises the following steps:
Step S101:Former message is received, the current CPU comprising sending node when sending the former message in the former message is counted
The corresponding sending node CPU counter time when device time is with the former message time-out.
Operating system can generally provide two kinds of time mechanism:When system time and CPU counter time, wherein system
Between, specific date-time can be converted into, its value can be changed, and the CPU counter time, since have recorded system self-starting
The CPU counter time, it is impossible to be converted into specific date-time, but current CPU counter time and standard time granularity
(such as:Second) can be changed.Therefore due to the characteristic that system time can be changed, it is made to be difficult to absolute monotonic increase,
So being not suitable for whether overtime for strict decision message.The CPU counter time, because it monotone increasing and can not can be repaiied
Change, so as to can ensure that monotonic increase absolute in node life cycle;And whether decision message is overtime unrelated with the time at exact date,
It is only relevant with message timeout interval, so, the mechanism in the present invention using the CPU counter time is relatively adapted to strict
Whether decision message is overtime.
Each operating system both provides the calling interface about the CPU counter time, such as under Linux environment, can pass through
Function clock_gettime (CLOCK_MONOTONIC ...), to obtain the CPU counter time;Under a windows environment, may be used
Call function GetTickCount (), QueryPerformanceCounter () etc., to obtain the CPU counter time.
Step S102:According to the current CPU counter time of the sending node in rear message received after the former message,
Judge whether the former message is overtime, if judging the former message time-out, perform step S103:Abandon the former message.;Otherwise perform
Step S104:Receive the former message.
Judge whether former message is overtime, the newest CPU specially according to the sending node in rear message for receiving is counted
The device time, and the CPU counter time of sending node is locally recorded, the newest CPU meters of the two middle sending node will be determined
The device time is counted compared with the time-out time of the former message, if the sending node newest CPU counter time is in the former message
After time-out time, it is determined that the former message time-out;Otherwise, it determines the former message has not timed out.
When sending node sends former message, the node is sent into the current CPU counter time of the former message and is sent out
The time-out time of the former message is given to set in transmitted former message, whether time-out is sentenced so that receiving node carries out former message
It is disconnected.Specifically, after receiving node receives the former message, its time-out time being obtained from the former message and sending node sending and is somebody's turn to do
CPU counter time during message, the CPU counter time of the sending node of local record is then updated, specific treatment is:Take
MAX (the sending node newest CPU counter time in message locally records the CPU counter time of sending node), with above-mentioned
The CPU counter time for taking the sending node that MAX is worth to is defined to update the CPU counter time of sending node, and then sentences
Whether overtime determine message:If the CPU counter time of the sending node after updating is in the overtime time of former message, and (correspondence sends
The CPU counter time of node) after, then former message is time-out;Otherwise, former message has not timed out.
Above-mentioned method, the time-out that the former message is also sent after the former message time-out time including sending node is led to
Know, the time-out time is represented with the CPU counter time of sending node.After setting waiting-timeout, it is necessary to reach the overtime moment
Time-out is just calculated, notifies that the time point of time-out must be after the overtime moment (containing the overtime moment).Find in an experiment, in Linux
Such as the timeout mechanism that pthread_cond_timedwait is provided, it notifies that near the overtime moment, i.e., the overtime time be
May be notified before the overtime moment overtime (although error very little).If controlling time-out using this class function, may be super
When the time in both have sent former message, re-transmission message is have sent again, for receiving node, if after receiving and retransmitting message, then receiving
Former message, will be unable to judge that former message is expired, so as to trigger former message interference problem.So, using the overtime letter of relevant control
, it is necessary to further encapsulation during number, it is ensured that notify the time point of time-out not before the overtime moment.In the embodiment of the present invention, use
Make sending node that the time-out notification of the former message is sent after the former message time-out time, examined by setting counter countdown
Whether survey reaches the overtime moment.
Former message interference problem, is mostly derived from two aspects:On the one hand, because time-out and Network Abnormal cause former message to be later than
Retransmit message sink;On the other hand, because sending node program is restarted and Network Abnormal, receiving node is caused in reception processing
After retransmitting message, the former message before sending node program is restarted (in the case where former message has not timed out) is received, on solving
Former message interference, the method for the preventing interference of original message provided in the embodiment of the present invention, also including being the section caused by situation are provided
Point sets life cycle, and the life cycle is identified by sending node present system time, process identification (PID) and random number, wherein saving
Point includes sending node and receiving node.
Node life cycle establishes, and refers to after node procedure startup, and other nodes being attached thereto discard company of haveing been friends in the past first
(old connection refers to the connection set up in life cycle before current life cycle) is connect, new connection is then set up.Connection between node
It is divided into actively connection and passive two kinds of connection;The process that node life cycle establishes, specifically as shown in Figures 2 to 4,
When setting up connection between node, the life cycle mark of oneself is sent and has extremely been connected with it or section just in this connection
Point.After node starts, the life cycle mark of the node is firstly generated.Node life cycle mark is used to distinguish node institute before this
There is startup optimization process, can represent that node life cycle marks by parameter group (present system time, process PID, random number)
Know.After generation node life cycle mark, if set up with interdependent node with the identity of active connection side connecting.Passive connection side receives
To after connection request, the life cycle for first checking for Correspondent Node identifies whether to change, and in the event of changing, then needs release
Connection have been friends in the past against the interference of old connection message, and records new life cycle mark, receive new connection and by the existence of itself
Phase mark informs active connection side.
During as passive connection side, it is set up with active connection side and is connected and can relatively lag behind, and its lag time is actively connected
Detecting period and the influence in connection reconstruction cycle of the side of connecing to connecting fault.After active connection side perceives connecting fault, will send out
Play connection reconstruction and carry the life cycle mark of active connection side, after passive connection side completes connection to set up, itself will be carried
Life cycle mark response active connection side, active connection side checks whether passive connection side sends out according to the life cycle mark of other side
Raw life cycle change, in the event of changing, then discharges connection of haveing been friends in the past, records new life cycle mark, and initiate connection reconstruction.
When changing the life cycle of sending node, when identifying that the message is the life cycle before current life cycle
Send, then abandon the message;Otherwise, the message is received.
In the method for the preventing interference of original message for providing in embodiments of the present invention, by introducing node life cycle, it is ensured that
Inter-node communication all carries out within a life cycle for stabilization, it is to avoid because the former message triggered across multiple life cycles is disturbed
Problem.
As shown in figure 5, the embodiment of the invention provides a kind of preventing interference of original message device, it includes:Receiving unit 501,
For receiving former message, comprising the current CPU counter time of sending node and the original when sending the former message in the former message
Corresponding sending node CPU counter time during message time-out;Processing unit 502, for according to after receiving the former message
The sending node current CPU counter time in rear message, judge whether the former message is overtime, however, it is determined that the former message surpasses
When, then abandon the message;Otherwise, the former message is received.
Processing unit 502, including overtime judging unit, for according to the hair in rear message received after the former message
Send node the current CPU counter time, judge whether the former message is overtime;Execution unit, has surpassed for the former message when determination
When, then abandon the former message;Otherwise, the former message is received.
Preventing interference of original message device can also include time-out notification unit, for making sending node in former message time-out
Between after send the time-out notification of the former message, the time-out time is represented with the CPU counter time of sending node.
Preventing interference of original message device can also include setting unit, and for setting life cycle for node, life cycle is by hair
Node present system time, process identification (PID) and random number is sent to identify, its interior joint includes sending node and receiving node.
Preventing interference of original message device can also include life cycle transmitting element, during for setting up connection between node, will save
The life cycle mark of point oneself sends and has extremely been connected with it or node just in this connection.
Preventing interference of original message device can also judge execution unit including life cycle, be sent out for the life cycle when sending node
During changing, when identifying what is sent in the former message is life cycle before current life cycle, then the former message is abandoned;It is no
Then, the former message is received.
The embodiment provides a kind of method and device of preventing interference of original message, by selecting during CPU counter
Between as the chronograph mechanism between node and the interference agreement using anti-former message, relieve between node to time synchronized software according to
Rely, the scheme that alternative existing timestamp and time synchronized are combined, eliminate the dependence to time synchronized software, and reduce distribution
Deployment cost and the clock hardware requirement of formula system, effectively eliminate the problem of former message interference.
The above embodiments are merely illustrative of the technical solutions of the present invention, rather than is limited.Therefore, without departing substantially from this
In the case of the spiritual and its essence of invention, those skilled in the art can be variously modified, replace and modification.It will be apparent that but
These change, replacement and modification should be all covered by within the protection domain of the claims in the present invention.
Claims (10)
1. a kind of method of preventing interference of original message, it is characterised in that including:
Receive former message, in the former message comprising the current CPU counter time of sending node when sending the former message and
Corresponding sending node CPU counter time during the former message time-out;
According to the current CPU counter time of the sending node in rear message received after the former message, the original is judged
Whether message is overtime, however, it is determined that the former message time-out, then abandon the former message;Otherwise, the former message is received;
Judge whether the former message is overtime, when specially according to the newest CPU counter of sending node in rear message is received
Between, and local record sending node the CPU counter time, the newest CPU counter of the two middle sending node will be determined
Time is compared with the time-out time of the former message, if the newest CPU counter time is in the time-out of the former message
After time, it is determined that the former message time-out, the former message is abandoned;Otherwise, it determines the former message has not timed out, institute is received
State former message.
2. the method for claim 1, it is characterised in that also including sending node after the former message time-out time
The time-out notification of the former message is sent, the time-out time is represented with the CPU counter time of sending node.
3. the method for claim 1, it is characterised in that also including being that the node sets life cycle, the life cycle
Identified by sending node present system time, process identification (PID) and random number, its interior joint includes sending node and receive to save
Point.
4. method as claimed in claim 3, it is characterised in that when setting up connection between node, hair is identified by the life cycle of oneself
Deliver to and be connected with it or node just in this connection.
5. the method as described in claim 3 or 4, it is characterised in that when changing the life cycle of sending node, work as identification
Going out the former message was sent in life cycle before current life cycle, then abandon the former message;Otherwise, receive described
Former message.
6. a kind of preventing interference of original message device, it is characterised in that including:
Receiving unit, for receiving former message, comprising the current CPU of sending node when sending the former message in the former message
Corresponding sending node CPU counter time when counter time and the former message time-out;
Processing unit, during for according to receiving the current CPU counter of the sending node in rear message after the former message
Between, judge whether the former message overtime, however, it is determined that the former message time-out, then abandon the former message;Otherwise, receive described
Former message;
The processing unit, including:
Overtime judging unit, for according to the sending node newest CPU counter time in rear message that receives, and local note
The CPU counter time of sending node is recorded, will determine that the two middle sending node newest CPU counter time disappears with the original
The time-out time of breath compares, and judges whether the former message is overtime;
Execution unit, for being had timed out when the determination former message, then abandons the former message;Otherwise, the former message is received.
7. device as claimed in claim 6, it is characterised in that also include:
Time-out notification unit, the time-out for making sending node that the former message is sent after the former message time-out time is led to
Know, the time-out time is represented with the CPU counter time of sending node.
8. device as claimed in claim 6, it is characterised in that also include:
Setting unit, for setting life cycle for the node, the life cycle passes through sending node present system time, process
Identify with random number to identify, its interior joint includes sending node and receiving node.
9. device as claimed in claim 8, it is characterised in that also include:
Life cycle transmitting element, during for setting up connection between node, by life cycle of the node oneself mark send to
It has been connected or node just in this connection.
10. device as claimed in claim 8 or 9, it is characterised in that also include:
Life cycle judges execution unit, for when changing the life cycle of sending node, when identifying that the former message is
Sent in life cycle before current life cycle, then abandon the former message;Otherwise, the former message is received.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310750769.0A CN103684738B (en) | 2013-12-31 | 2013-12-31 | A kind of method and device of preventing interference of original message |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310750769.0A CN103684738B (en) | 2013-12-31 | 2013-12-31 | A kind of method and device of preventing interference of original message |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103684738A CN103684738A (en) | 2014-03-26 |
CN103684738B true CN103684738B (en) | 2017-06-13 |
Family
ID=50321137
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310750769.0A Active CN103684738B (en) | 2013-12-31 | 2013-12-31 | A kind of method and device of preventing interference of original message |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103684738B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106533603A (en) * | 2016-12-20 | 2017-03-22 | 创新科存储技术有限公司 | Time synchronizing method and device for distributed system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1738305A (en) * | 2004-05-14 | 2006-02-22 | 国际商业机器公司 | Information processing apparatus, information system, proxy processing method |
CN101099320A (en) * | 2005-02-15 | 2008-01-02 | 思科技术公司 | Clock-based replay protection |
CN101179484A (en) * | 2006-11-09 | 2008-05-14 | 华为技术有限公司 | Method and system of synchronizing different media stream |
CN101800590A (en) * | 2009-12-25 | 2010-08-11 | 中兴通讯股份有限公司 | RRM (Radio Resource Management) request method, report method and BS (Base Station) and system |
CN103314341A (en) * | 2010-08-27 | 2013-09-18 | 总相位公司 | Real-time USB class level decoding |
WO2013155712A1 (en) * | 2012-04-20 | 2013-10-24 | 中兴通讯股份有限公司 | Key exchange method and device, and network element |
-
2013
- 2013-12-31 CN CN201310750769.0A patent/CN103684738B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1738305A (en) * | 2004-05-14 | 2006-02-22 | 国际商业机器公司 | Information processing apparatus, information system, proxy processing method |
CN101099320A (en) * | 2005-02-15 | 2008-01-02 | 思科技术公司 | Clock-based replay protection |
CN101179484A (en) * | 2006-11-09 | 2008-05-14 | 华为技术有限公司 | Method and system of synchronizing different media stream |
CN101800590A (en) * | 2009-12-25 | 2010-08-11 | 中兴通讯股份有限公司 | RRM (Radio Resource Management) request method, report method and BS (Base Station) and system |
CN103314341A (en) * | 2010-08-27 | 2013-09-18 | 总相位公司 | Real-time USB class level decoding |
WO2013155712A1 (en) * | 2012-04-20 | 2013-10-24 | 中兴通讯股份有限公司 | Key exchange method and device, and network element |
Also Published As
Publication number | Publication date |
---|---|
CN103684738A (en) | 2014-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101157100B1 (en) | Time synchronizing device and process and associated products | |
JP4571668B2 (en) | Method and communication system for establishing a global time base in a time-controlled communication system | |
JP7098007B2 (en) | Remote data synchronization methods and equipment for databases | |
CN110149220B (en) | Method and device for managing data transmission channel | |
EP2577946B1 (en) | Keep-alive hiatus declaration | |
CN111656698A (en) | Beam fault detection with different indication intervals | |
EP1931084B1 (en) | A method for getting the link estimating parameters | |
CN106302700B (en) | Distributed system consistent update method and system based on paxos algorithm | |
US20230199534A1 (en) | Service producer health-check | |
JP2010231310A (en) | Time correction device, time correction system, time correction method, and program | |
Facchinetti et al. | Real-time resource reservation protocol for wireless mobile ad hoc networks | |
CN103684738B (en) | A kind of method and device of preventing interference of original message | |
WO2007059667A1 (en) | A method for obtaining the network element alarm data | |
CN106656584B (en) | Distributed system invalid node judgment method | |
CN112822283B (en) | Edge node control method and device, control node and storage medium | |
CN101615998A (en) | A kind of method and system and access switch of in Ethernet, realizing clock synchronization | |
US20080211659A1 (en) | Apparatus and method for synchronizing alarm in fault management system | |
WO2014169547A1 (en) | Method and apparatus for processing operation on endpoint peripheral | |
CN114398223A (en) | Network server cluster availability monitoring method and system | |
CN112929354B (en) | Practical Byzantine fault-tolerant anti-attack deadlock method and device | |
WO2019153936A1 (en) | Home networking parameter configuration method, home gateway, and home networking terminal | |
Bondavalli et al. | A self-aware clock for pervasive computing systems | |
WO2006097048A1 (en) | Method for detecting the path configuration state of the opposite node and the method for establishing the connection | |
WO2011079561A1 (en) | Data synchronization method, system and client based on device management service | |
CN106992890A (en) | A kind of multiserver switching method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20211230 Address after: 1-3 / F, No.15 Haitai Huake street, Huayuan Industrial Zone, Xiqing District, Tianjin Patentee after: DAWNING INFORMATION INDUSTRY Co.,Ltd. Address before: 100193 building 36, Zhongguancun Software Park, 8 North East West Road, Haidian District, Beijing. Patentee before: DAWNING INFORMATION INDUSTRY Co.,Ltd. Patentee before: Wuxi City Cloud Computing Center Co., Ltd |
|
TR01 | Transfer of patent right |