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
9987e139
Commit
9987e139
authored
Mar 13, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change interval accounting to use milliseconds.
parent
28f2cfc3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
24 deletions
+23
-24
babel.c
babel.c
+8
-8
message.c
message.c
+8
-8
network.c
network.c
+7
-8
No files found.
babel.c
View file @
9987e139
...
@@ -161,16 +161,16 @@ main(int argc, char **argv)
...
@@ -161,16 +161,16 @@ main(int argc, char **argv)
}
}
}
else
if
(
strcmp
(
*
arg
,
"-h"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-h"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
wireless_hello_interval
=
atoi
(
*
arg
);
wireless_hello_interval
=
atoi
(
*
arg
)
*
1000
;
}
else
if
(
strcmp
(
*
arg
,
"-H"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-H"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
wired_hello_interval
=
atoi
(
*
arg
);
wired_hello_interval
=
atoi
(
*
arg
)
*
1000
;
}
else
if
(
strcmp
(
*
arg
,
"-i"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-i"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
idle_hello_interval
=
atoi
(
*
arg
);
idle_hello_interval
=
atoi
(
*
arg
)
*
1000
;
}
else
if
(
strcmp
(
*
arg
,
"-u"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-u"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
update_interval
=
atoi
(
*
arg
);
update_interval
=
atoi
(
*
arg
)
*
1000
;
}
else
if
(
strcmp
(
*
arg
,
"-k"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-k"
)
==
0
)
{
SHIFTE
();
SHIFTE
();
kernel_metric
=
atoi
(
*
arg
);
kernel_metric
=
atoi
(
*
arg
);
...
@@ -248,18 +248,18 @@ main(int argc, char **argv)
...
@@ -248,18 +248,18 @@ main(int argc, char **argv)
}
}
if
(
wireless_hello_interval
<=
0
)
if
(
wireless_hello_interval
<=
0
)
wireless_hello_interval
=
6
;
wireless_hello_interval
=
6
000
;
if
(
wired_hello_interval
<=
0
)
if
(
wired_hello_interval
<=
0
)
wired_hello_interval
=
30
;
wired_hello_interval
=
30
000
;
if
(
update_interval
<=
0
)
if
(
update_interval
<=
0
)
update_interval
=
update_interval
=
MIN
(
MAX
(
wireless_hello_interval
*
5
,
wired_hello_interval
),
MIN
(
MAX
(
wireless_hello_interval
*
5
,
wired_hello_interval
),
70
);
70
000
);
if
(
seqno_interval
<=
0
)
if
(
seqno_interval
<=
0
)
seqno_interval
=
MAX
(
wireless_hello_interval
-
1
,
2
);
seqno_interval
=
MAX
(
wireless_hello_interval
-
1
00
,
2000
);
if
(
do_daemonise
)
{
if
(
do_daemonise
)
{
if
(
logfile
==
NULL
)
if
(
logfile
==
NULL
)
...
...
message.c
View file @
9987e139
...
@@ -476,7 +476,7 @@ send_hello(struct network *net)
...
@@ -476,7 +476,7 @@ send_hello(struct network *net)
{
{
int
changed
;
int
changed
;
changed
=
update_hello_interval
(
net
);
changed
=
update_hello_interval
(
net
);
send_hello_noupdate
(
net
,
net
->
hello_interval
*
10
0
);
send_hello_noupdate
(
net
,
(
net
->
hello_interval
+
9
)
/
1
0
);
if
(
changed
)
if
(
changed
)
send_ihu
(
NULL
,
net
);
send_ihu
(
NULL
,
net
);
}
}
...
@@ -752,7 +752,7 @@ send_update(struct network *net, int urgent,
...
@@ -752,7 +752,7 @@ send_update(struct network *net, int urgent,
if
(
prefix
==
NULL
)
{
if
(
prefix
==
NULL
)
{
send_self_update
(
net
,
0
);
send_self_update
(
net
,
0
);
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
update_interval
*
1000
);
update_interval
);
}
else
if
(
find_xroute
(
prefix
,
plen
))
{
}
else
if
(
find_xroute
(
prefix
,
plen
))
{
buffer_update
(
net
,
prefix
,
plen
);
buffer_update
(
net
,
prefix
,
plen
);
}
}
...
@@ -780,7 +780,7 @@ send_update(struct network *net, int urgent,
...
@@ -780,7 +780,7 @@ send_update(struct network *net, int urgent,
if
(
routes
[
i
].
installed
)
if
(
routes
[
i
].
installed
)
buffer_update
(
net
,
routes
[
i
].
src
->
prefix
,
routes
[
i
].
src
->
plen
);
buffer_update
(
net
,
routes
[
i
].
src
->
prefix
,
routes
[
i
].
src
->
plen
);
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
update_interval
*
1000
);
update_interval
);
}
}
schedule_update_flush
(
net
,
urgent
);
schedule_update_flush
(
net
,
urgent
);
}
}
...
@@ -788,7 +788,7 @@ send_update(struct network *net, int urgent,
...
@@ -788,7 +788,7 @@ send_update(struct network *net, int urgent,
void
void
update_myseqno
(
int
force
)
update_myseqno
(
int
force
)
{
{
if
(
force
||
seqno_time
+
seqno_interval
<
now
.
tv_sec
)
{
if
(
force
||
seqno_time
+
(
seqno_interval
+
500
)
/
1000
<
now
.
tv_sec
)
{
myseqno
=
seqno_plus
(
myseqno
,
1
);
myseqno
=
seqno_plus
(
myseqno
,
1
);
seqno_time
=
now
.
tv_sec
;
seqno_time
=
now
.
tv_sec
;
}
}
...
@@ -813,7 +813,7 @@ send_self_update(struct network *net, int force_seqno)
...
@@ -813,7 +813,7 @@ send_self_update(struct network *net, int force_seqno)
debugf
(
"Sending self update to %s.
\n
"
,
net
->
ifname
);
debugf
(
"Sending self update to %s.
\n
"
,
net
->
ifname
);
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
net
->
self_update_interval
*
1000
);
net
->
self_update_interval
);
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
{
send_update
(
net
,
0
,
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
);
send_update
(
net
,
0
,
xroutes
[
i
].
prefix
,
xroutes
[
i
].
plen
);
}
}
...
@@ -881,7 +881,7 @@ send_ihu(struct neighbour *neigh, struct network *net)
...
@@ -881,7 +881,7 @@ send_ihu(struct neighbour *neigh, struct network *net)
}
}
}
}
delay_jitter
(
&
net
->
ihu_time
,
&
net
->
ihu_timeout
,
delay_jitter
(
&
net
->
ihu_time
,
&
net
->
ihu_timeout
,
net
->
ihu_interval
*
1000
);
net
->
ihu_interval
);
}
else
{
}
else
{
int
rxcost
;
int
rxcost
;
...
@@ -892,8 +892,8 @@ send_ihu(struct neighbour *neigh, struct network *net)
...
@@ -892,8 +892,8 @@ send_ihu(struct neighbour *neigh, struct network *net)
rxcost
=
neighbour_rxcost
(
neigh
);
rxcost
=
neighbour_rxcost
(
neigh
);
if
(
net
->
ihu_interval
*
10
0
<=
0xFFFF
)
if
(
(
net
->
ihu_interval
+
9
)
/
1
0
<=
0xFFFF
)
interval
=
net
->
ihu_interval
*
10
0
;
interval
=
(
net
->
ihu_interval
+
9
)
/
1
0
;
else
else
interval
=
0
;
interval
=
0
;
...
...
network.c
View file @
9987e139
...
@@ -60,7 +60,6 @@ add_network(char *ifname)
...
@@ -60,7 +60,6 @@ add_network(char *ifname)
nets
[
numnets
].
buffered
=
0
;
nets
[
numnets
].
buffered
=
0
;
nets
[
numnets
].
bucket_time
=
now
.
tv_sec
;
nets
[
numnets
].
bucket_time
=
now
.
tv_sec
;
nets
[
numnets
].
bucket
=
0
;
nets
[
numnets
].
bucket
=
0
;
nets
[
numnets
].
hello_interval
=
10000
;
nets
[
numnets
].
hello_seqno
=
(
random
()
&
0xFFFF
);
nets
[
numnets
].
hello_seqno
=
(
random
()
&
0xFFFF
);
numnets
++
;
numnets
++
;
return
&
nets
[
numnets
-
1
];
return
&
nets
[
numnets
-
1
];
...
@@ -101,7 +100,7 @@ update_hello_interval(struct network *net)
...
@@ -101,7 +100,7 @@ update_hello_interval(struct network *net)
}
}
net
->
self_update_interval
=
net
->
self_update_interval
=
MAX
(
15
+
net
->
hello_interval
/
2
,
net
->
hello_interval
);
MAX
(
15
000
+
net
->
hello_interval
/
2
,
net
->
hello_interval
);
return
rc
;
return
rc
;
}
}
...
@@ -111,7 +110,7 @@ update_hello_interval(struct network *net)
...
@@ -111,7 +110,7 @@ update_hello_interval(struct network *net)
unsigned
int
unsigned
int
jitter
(
struct
network
*
net
)
jitter
(
struct
network
*
net
)
{
{
unsigned
interval
=
net
->
hello_interval
*
1000
;
unsigned
interval
=
net
->
hello_interval
;
interval
=
MIN
(
interval
,
2000
);
interval
=
MIN
(
interval
,
2000
);
return
(
interval
/
2
+
random
()
%
interval
)
/
4
;
return
(
interval
/
2
+
random
()
%
interval
)
/
4
;
}
}
...
@@ -119,7 +118,7 @@ jitter(struct network *net)
...
@@ -119,7 +118,7 @@ jitter(struct network *net)
unsigned
int
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
)
update_jitter
(
struct
network
*
net
,
int
urgent
)
{
{
unsigned
interval
=
net
->
hello_interval
*
1000
;
unsigned
interval
=
net
->
hello_interval
;
if
(
urgent
)
if
(
urgent
)
interval
=
MIN
(
interval
,
100
);
interval
=
MIN
(
interval
,
100
);
else
else
...
@@ -244,13 +243,13 @@ network_up(struct network *net, int up)
...
@@ -244,13 +243,13 @@ network_up(struct network *net, int up)
/* But don't bail out for now. */
/* But don't bail out for now. */
}
}
delay_jitter
(
&
net
->
hello_time
,
&
net
->
hello_timeout
,
delay_jitter
(
&
net
->
hello_time
,
&
net
->
hello_timeout
,
net
->
hello_interval
*
1000
);
net
->
hello_interval
);
delay_jitter
(
&
net
->
ihu_time
,
&
net
->
ihu_timeout
,
delay_jitter
(
&
net
->
ihu_time
,
&
net
->
ihu_timeout
,
net
->
ihu_interval
*
1000
);
net
->
ihu_interval
);
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
delay_jitter
(
&
net
->
self_update_time
,
&
net
->
self_update_timeout
,
net
->
self_update_interval
*
1000
);
net
->
self_update_interval
);
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
delay_jitter
(
&
net
->
update_time
,
&
net
->
update_timeout
,
update_interval
*
1000
);
update_interval
);
send_hello
(
net
);
send_hello
(
net
);
send_request
(
net
,
NULL
,
0
,
0
,
0
,
0
);
send_request
(
net
,
NULL
,
0
,
0
,
0
,
0
);
}
else
{
}
else
{
...
...
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