Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
0de5fc1a
Commit
0de5fc1a
authored
Mar 31, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement resending of updates.
parent
29c0063e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
45 deletions
+58
-45
message.c
message.c
+3
-2
resend.c
resend.c
+53
-42
resend.h
resend.h
+2
-1
No files found.
message.c
View file @
0de5fc1a
...
...
@@ -317,7 +317,8 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
send_unicast_request
(
successor
,
prefix
,
plen
,
hop_count
-
1
,
seqno
,
router_hash
);
record_request
(
prefix
,
plen
,
seqno
,
router_hash
,
neigh
->
network
,
0
);
record_resend
(
RESEND_REQUEST
,
prefix
,
plen
,
seqno
,
router_hash
,
neigh
->
network
,
0
);
}
...
...
@@ -551,7 +552,7 @@ send_request_resend(struct neighbour *neigh,
time
=
MIN
(
time
,
wireless_hello_interval
/
2
);
time
=
MIN
(
time
,
wired_hello_interval
/
2
);
time
=
MAX
(
time
,
10
);
record_re
quest
(
prefix
,
plen
,
seqno
,
router_hash
,
record_re
send
(
RESEND_REQUEST
,
prefix
,
plen
,
seqno
,
router_hash
,
neigh
?
neigh
->
network
:
NULL
,
time
);
}
...
...
resend.c
View file @
0de5fc1a
...
...
@@ -73,11 +73,11 @@ find_request(const unsigned char *prefix, unsigned char plen,
}
int
record_re
quest
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
struct
network
*
network
,
int
delay
)
record_re
send
(
int
kind
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
struct
network
*
network
,
int
delay
)
{
struct
resend
*
re
quest
;
struct
resend
*
re
send
;
unsigned
int
ifindex
=
network
?
network
->
ifindex
:
0
;
if
(
input_filter
(
NULL
,
prefix
,
plen
,
NULL
,
ifindex
)
>=
INFINITY
||
...
...
@@ -87,42 +87,42 @@ record_request(const unsigned char *prefix, unsigned char plen,
if
(
delay
>=
0xFFFF
)
delay
=
0xFFFF
;
re
quest
=
find_request
(
prefix
,
plen
,
NULL
);
if
(
re
quest
)
{
if
(
re
quest
->
delay
&&
delay
)
re
quest
->
delay
=
MIN
(
request
->
delay
,
delay
);
re
send
=
find_resend
(
kind
,
prefix
,
plen
,
NULL
);
if
(
re
send
)
{
if
(
re
send
->
delay
&&
delay
)
re
send
->
delay
=
MIN
(
resend
->
delay
,
delay
);
else
if
(
delay
)
re
quest
->
delay
=
delay
;
re
quest
->
time
=
now
;
re
quest
->
max
=
128
;
if
(
re
quest
->
router_hash
==
router_hash
&&
seqno_compare
(
re
quest
->
seqno
,
seqno
)
>
0
)
{
re
send
->
delay
=
delay
;
re
send
->
time
=
now
;
re
send
->
max
=
kind
==
RESEND_REQUEST
?
128
:
UPDATE_MAX
;
if
(
re
send
->
router_hash
==
router_hash
&&
seqno_compare
(
re
send
->
seqno
,
seqno
)
>
0
)
{
return
0
;
}
re
quest
->
router_hash
=
router_hash
;
re
quest
->
seqno
=
seqno
;
if
(
re
quest
->
network
!=
network
)
re
quest
->
network
=
NULL
;
re
send
->
router_hash
=
router_hash
;
re
send
->
seqno
=
seqno
;
if
(
re
send
->
network
!=
network
)
re
send
->
network
=
NULL
;
}
else
{
re
quest
=
malloc
(
sizeof
(
struct
resend
));
if
(
re
quest
==
NULL
)
re
send
=
malloc
(
sizeof
(
struct
resend
));
if
(
re
send
==
NULL
)
return
-
1
;
re
quest
->
kind
=
RESEND_REQUEST
;
re
quest
->
max
=
128
;
re
quest
->
delay
=
delay
;
memcpy
(
re
quest
->
prefix
,
prefix
,
16
);
re
quest
->
plen
=
plen
;
re
quest
->
seqno
=
seqno
;
re
quest
->
router_hash
=
router_hash
;
re
quest
->
network
=
network
;
re
quest
->
time
=
now
;
re
quest
->
next
=
to_resend
;
to_resend
=
re
quest
;
re
send
->
kind
=
kind
;
re
send
->
max
=
kind
==
RESEND_REQUEST
?
128
:
UPDATE_MAX
;
re
send
->
delay
=
delay
;
memcpy
(
re
send
->
prefix
,
prefix
,
16
);
re
send
->
plen
=
plen
;
re
send
->
seqno
=
seqno
;
re
send
->
router_hash
=
router_hash
;
re
send
->
network
=
network
;
re
send
->
time
=
now
;
re
send
->
next
=
to_resend
;
to_resend
=
re
send
;
}
if
(
re
quest
->
delay
)
{
if
(
re
send
->
delay
)
{
struct
timeval
timeout
;
timeval_plus_msec
(
&
timeout
,
&
re
quest
->
time
,
request
->
delay
);
timeval_plus_msec
(
&
timeout
,
&
re
send
->
time
,
resend
->
delay
);
timeval_min
(
&
resend_time
,
&
timeout
);
}
return
1
;
...
...
@@ -235,21 +235,32 @@ recompute_resend_time()
void
do_resend
()
{
struct
resend
*
re
quest
;
struct
resend
*
re
send
;
re
quest
=
to_resend
;
while
(
re
quest
)
{
if
(
!
resend_expired
(
re
quest
)
&&
request
->
delay
>
0
&&
request
->
max
>
0
)
{
re
send
=
to_resend
;
while
(
re
send
)
{
if
(
!
resend_expired
(
re
send
)
&&
resend
->
delay
>
0
&&
resend
->
max
>
0
)
{
struct
timeval
timeout
;
timeval_plus_msec
(
&
timeout
,
&
re
quest
->
time
,
request
->
delay
);
timeval_plus_msec
(
&
timeout
,
&
re
send
->
time
,
resend
->
delay
);
if
(
timeval_compare
(
&
now
,
&
timeout
)
>=
0
)
{
send_request
(
NULL
,
request
->
prefix
,
request
->
plen
,
127
,
request
->
seqno
,
request
->
router_hash
);
request
->
delay
*=
2
;
request
->
max
--
;
switch
(
resend
->
kind
)
{
case
RESEND_REQUEST
:
send_request
(
resend
->
network
,
resend
->
prefix
,
resend
->
plen
,
127
,
resend
->
seqno
,
resend
->
router_hash
);
resend
->
delay
*=
2
;
break
;
case
RESEND_UPDATE
:
send_update
(
resend
->
network
,
1
,
resend
->
prefix
,
resend
->
plen
);
/* No back-off for updates */
break
;
default:
abort
();
}
resend
->
max
--
;
}
}
re
quest
=
request
->
next
;
re
send
=
resend
->
next
;
}
recompute_resend_time
();
}
resend.h
View file @
0de5fc1a
...
...
@@ -21,6 +21,7 @@ THE SOFTWARE.
*/
#define REQUEST_TIMEOUT 125000
#define UPDATE_MAX 4
#define RESEND_REQUEST 1
#define RESEND_UPDATE 2
...
...
@@ -42,7 +43,7 @@ extern struct timeval resend_time;
struct
resend
*
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
resend
**
previous_return
);
int
record_re
quest
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
int
record_re
send
(
int
kind
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
struct
network
*
net
,
int
delay
);
int
unsatisfied_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment