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
4637afd7
Commit
4637afd7
authored
Aug 17, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timeout neighbours after three missing ihus.
parent
86c82f44
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
message.c
message.c
+1
-1
neighbour.c
neighbour.c
+14
-5
neighbour.h
neighbour.h
+1
-1
No files found.
message.c
View file @
4637afd7
...
@@ -134,7 +134,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -134,7 +134,7 @@ parse_packet(const unsigned char *from, struct network *net,
format_address
(
from
));
format_address
(
from
));
if
(
plen
==
0xFF
||
memcmp
(
myid
,
address
,
16
)
==
0
)
{
if
(
plen
==
0xFF
||
memcmp
(
myid
,
address
,
16
)
==
0
)
{
neigh
->
txcost
=
metric
;
neigh
->
txcost
=
metric
;
neigh
->
ihu_time
=
now
.
tv_sec
;
neigh
->
ihu_time
=
now
;
neigh
->
ihu_interval
=
seqno
;
neigh
->
ihu_interval
=
seqno
;
update_neighbour_metric
(
neigh
);
update_neighbour_metric
(
neigh
);
}
}
...
...
neighbour.c
View file @
4637afd7
...
@@ -105,7 +105,7 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
...
@@ -105,7 +105,7 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
memcpy
(
neigh
->
address
,
address
,
16
);
memcpy
(
neigh
->
address
,
address
,
16
);
neigh
->
reach
=
0
;
neigh
->
reach
=
0
;
neigh
->
txcost
=
INFINITY
;
neigh
->
txcost
=
INFINITY
;
neigh
->
ihu_time
=
now
.
tv_sec
;
neigh
->
ihu_time
=
now
;
neigh
->
hello_time
=
zero
;
neigh
->
hello_time
=
zero
;
neigh
->
hello_interval
=
0
;
neigh
->
hello_interval
=
0
;
neigh
->
ihu_interval
=
0
;
neigh
->
ihu_interval
=
0
;
...
@@ -198,7 +198,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
...
@@ -198,7 +198,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
int
int
check_neighbours
()
check_neighbours
()
{
{
int
i
,
changed
;
int
i
,
changed
,
delay
;
int
msecs
=
50000
;
int
msecs
=
50000
;
debugf
(
"Checking neighbours.
\n
"
);
debugf
(
"Checking neighbours.
\n
"
);
...
@@ -215,11 +215,23 @@ check_neighbours()
...
@@ -215,11 +215,23 @@ check_neighbours()
continue
;
continue
;
}
}
delay
=
timeval_minus_msec
(
&
now
,
&
neighs
[
i
].
ihu_time
);
if
(
delay
>=
180000
||
(
neighs
[
i
].
ihu_interval
>
0
&&
delay
>=
neighs
[
i
].
ihu_interval
*
10
*
4
))
{
neighs
[
i
].
txcost
=
INFINITY
;
neighs
[
i
].
ihu_time
=
now
;
changed
=
1
;
}
if
(
changed
)
if
(
changed
)
update_neighbour_metric
(
&
neighs
[
i
]);
update_neighbour_metric
(
&
neighs
[
i
]);
if
(
neighs
[
i
].
hello_interval
>
0
)
if
(
neighs
[
i
].
hello_interval
>
0
)
msecs
=
MIN
(
msecs
,
neighs
[
i
].
hello_interval
*
10
);
msecs
=
MIN
(
msecs
,
neighs
[
i
].
hello_interval
*
10
);
if
(
neighs
[
i
].
ihu_interval
>
0
)
msecs
=
MIN
(
msecs
,
neighs
[
i
].
ihu_interval
*
10
);
}
}
return
msecs
;
return
msecs
;
...
@@ -262,9 +274,6 @@ neighbour_cost(struct neighbour *neigh)
...
@@ -262,9 +274,6 @@ neighbour_cost(struct neighbour *neigh)
{
{
int
a
,
b
;
int
a
,
b
;
if
(
now
.
tv_sec
-
neigh
->
ihu_time
>=
180
)
return
INFINITY
;
a
=
neigh
->
txcost
;
a
=
neigh
->
txcost
;
if
(
a
>=
INFINITY
)
if
(
a
>=
INFINITY
)
...
...
neighbour.h
View file @
4637afd7
...
@@ -27,8 +27,8 @@ struct neighbour {
...
@@ -27,8 +27,8 @@ struct neighbour {
unsigned
short
txcost
;
unsigned
short
txcost
;
/* This is -1 when unknown, so don't make it unsigned */
/* This is -1 when unknown, so don't make it unsigned */
int
hello_seqno
;
int
hello_seqno
;
int
ihu_time
;
struct
timeval
hello_time
;
struct
timeval
hello_time
;
struct
timeval
ihu_time
;
unsigned
short
hello_interval
;
/* in centiseconds */
unsigned
short
hello_interval
;
/* in centiseconds */
unsigned
short
ihu_interval
;
/* in centiseconds */
unsigned
short
ihu_interval
;
/* in centiseconds */
struct
network
*
network
;
struct
network
*
network
;
...
...
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