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
23956f1d
Commit
23956f1d
authored
Jun 12, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use roughly throughout.
This very slightly reduces the amount of jitter in some cases.
parent
067cd537
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
20 deletions
+17
-20
babel.c
babel.c
+12
-12
message.c
message.c
+1
-1
network.c
network.c
+4
-7
No files found.
babel.c
View file @
23956f1d
...
...
@@ -512,17 +512,17 @@ main(int argc, char **argv)
kernel_routes_changed
=
0
;
kernel_link_changed
=
0
;
kernel_addr_changed
=
0
;
kernel_dump_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
kernel_dump_time
=
now
.
tv_sec
+
roughly
(
30
)
;
schedule_neighbours_check
(
5000
,
1
);
expiry_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
source_expiry_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
expiry_time
=
now
.
tv_sec
+
roughly
(
30
)
;
source_expiry_time
=
now
.
tv_sec
+
roughly
(
300
)
;
/* Make some noise so that others notice us */
FOR_ALL_NETS
(
net
)
{
if
(
!
net
->
up
)
continue
;
/* Apply jitter before we send the first message. */
usleep
(
5000
+
random
()
%
10000
);
usleep
(
roughly
(
10000
)
);
gettime
(
&
now
);
send_hello
(
net
);
send_self_update
(
net
,
0
);
...
...
@@ -631,9 +631,9 @@ main(int argc, char **argv)
fprintf
(
stderr
,
"Warning: couldn't check exported routes.
\n
"
);
kernel_routes_changed
=
kernel_addr_changed
=
0
;
if
(
kernel_socket
>=
0
)
kernel_dump_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
kernel_dump_time
=
now
.
tv_sec
+
roughly
(
300
)
;
else
kernel_dump_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
kernel_dump_time
=
now
.
tv_sec
+
roughly
(
30
)
;
}
if
(
timeval_compare
(
&
check_neighbours_timeout
,
&
now
)
<
0
)
{
...
...
@@ -647,12 +647,12 @@ main(int argc, char **argv)
check_networks
();
expire_routes
();
expire_resend
();
expiry_time
=
now
.
tv_sec
+
20
+
random
()
%
20
;
expiry_time
=
now
.
tv_sec
+
roughly
(
30
)
;
}
if
(
now
.
tv_sec
>=
source_expiry_time
)
{
expire_sources
();
source_expiry_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
source_expiry_time
=
now
.
tv_sec
+
roughly
(
300
)
;
}
FOR_ALL_NETS
(
net
)
{
...
...
@@ -699,7 +699,7 @@ main(int argc, char **argv)
}
debugf
(
"Exiting...
\n
"
);
usleep
(
5000
+
random
()
%
10000
);
usleep
(
roughly
(
10000
)
);
gettime
(
&
now
);
/* Uninstall and retract all routes. */
...
...
@@ -726,7 +726,7 @@ main(int argc, char **argv)
association caches. */
send_hello_noupdate
(
net
,
10
);
flushbuf
(
net
);
usleep
(
500
+
random
()
%
1000
);
usleep
(
roughly
(
1000
)
);
gettime
(
&
now
);
}
FOR_ALL_NETS
(
net
)
{
...
...
@@ -735,7 +735,7 @@ main(int argc, char **argv)
/* Make sure they got it. */
send_hello_noupdate
(
net
,
1
);
flushbuf
(
net
);
usleep
(
5000
+
random
()
%
10000
);
usleep
(
roughly
(
10000
)
);
gettime
(
&
now
);
network_up
(
net
,
0
);
}
...
...
@@ -808,7 +808,7 @@ schedule_neighbours_check(int msecs, int override)
{
struct
timeval
timeout
;
timeval_plus_msec
(
&
timeout
,
&
now
,
msecs
+
random
()
%
msecs
);
timeval_plus_msec
(
&
timeout
,
&
now
,
roughly
(
msecs
*
3
/
2
)
);
if
(
override
)
check_neighbours_timeout
=
timeout
;
else
...
...
message.c
View file @
23956f1d
...
...
@@ -413,7 +413,7 @@ void
schedule_flush_now
(
struct
network
*
net
)
{
/* Almost now */
int
msecs
=
5
+
random
()
%
10
;
int
msecs
=
roughly
(
10
)
;
if
(
net
->
flush_timeout
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_timeout
,
&
now
)
<
msecs
)
return
;
...
...
network.c
View file @
23956f1d
...
...
@@ -127,8 +127,8 @@ jitter(struct network *net, int urgent)
if
(
urgent
)
interval
=
MIN
(
interval
,
100
);
else
interval
=
MIN
(
interval
,
2
000
);
return
(
interval
/
2
+
random
()
%
interval
)
/
4
;
interval
=
MIN
(
interval
,
4
000
);
return
roughly
(
interval
)
/
4
;
}
unsigned
int
...
...
@@ -139,17 +139,14 @@ update_jitter(struct network *net, int urgent)
interval
=
MIN
(
interval
,
100
);
else
interval
=
MIN
(
interval
,
4000
);
return
(
interval
/
2
+
random
()
%
interval
);
return
roughly
(
interval
);
}
void
delay_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
)
{
int
delay
;
delay
=
msecs
*
2
/
3
+
random
()
%
(
msecs
*
2
/
3
);
*
time
=
now
;
timeval_plus_msec
(
timeout
,
&
now
,
delay
);
timeval_plus_msec
(
timeout
,
&
now
,
roughly
(
msecs
)
);
}
static
int
...
...
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