|
Algorithm 2 Forwarding Mode Switch |
Input: the packet p received by node ni Output: greedy mode or void recovery mode
-
1:
node ni updates p with di
-
2:
ni.void-flag=0
-
3:
BroadcastFlag=True // indicate that whether or not node ni transmits p
-
4:
RecoveryFlag=True // indicate whether to activate void recovery mode or not
-
5:
while (BroadcastFlag) do
-
6:
ni broadcasts p and set a specific timer
-
7:
while (timer is not expired) and (RecoveryFlag) do
-
8:
overhear the channel
-
9:
if
ni overhears p being transmitted then
-
10:
RecoveryFlag=False
-
11:
end if
-
12:
end while
-
13:
if (RecoveryFlag) and (!ni.void-flag) then //overhear no transmission of p within its
//timer and it is the first time to activate the void recovery mode
-
14:
set ni.void-flag to 1
-
15:
else
-
16:
drop the packet p
-
17:
BroadcastFlag=False
-
18:
end if
-
19:
end while
|