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
aca69890
Commit
aca69890
authored
Mar 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add urgent argument to jitter.
parent
17ef2b95
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
message.c
message.c
+1
-1
network.c
network.c
+5
-2
network.h
network.h
+1
-1
No files found.
message.c
View file @
aca69890
...
@@ -373,7 +373,7 @@ flushbuf(struct network *net)
...
@@ -373,7 +373,7 @@ flushbuf(struct network *net)
static
void
static
void
schedule_flush
(
struct
network
*
net
)
schedule_flush
(
struct
network
*
net
)
{
{
int
msecs
=
jitter
(
net
);
int
msecs
=
jitter
(
net
,
0
);
if
(
net
->
flush_timeout
.
tv_sec
!=
0
&&
if
(
net
->
flush_timeout
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_timeout
,
&
now
)
<
msecs
)
timeval_minus_msec
(
&
net
->
flush_timeout
,
&
now
)
<
msecs
)
return
;
return
;
...
...
network.c
View file @
aca69890
...
@@ -108,9 +108,12 @@ update_hello_interval(struct network *net)
...
@@ -108,9 +108,12 @@ update_hello_interval(struct network *net)
/* This should be no more than half the hello interval, so that hellos
/* This should be no more than half the hello interval, so that hellos
aren't sent late. The result is in milliseconds. */
aren't sent late. The result is in milliseconds. */
unsigned
int
unsigned
int
jitter
(
struct
network
*
net
)
jitter
(
struct
network
*
net
,
int
urgent
)
{
{
unsigned
interval
=
net
->
hello_interval
;
unsigned
interval
=
net
->
hello_interval
;
if
(
urgent
)
interval
=
MIN
(
interval
,
100
);
else
interval
=
MIN
(
interval
,
2000
);
interval
=
MIN
(
interval
,
2000
);
return
(
interval
/
2
+
random
()
%
interval
)
/
4
;
return
(
interval
/
2
+
random
()
%
interval
)
/
4
;
}
}
...
...
network.h
View file @
aca69890
...
@@ -54,7 +54,7 @@ extern int numnets;
...
@@ -54,7 +54,7 @@ extern int numnets;
struct
network
*
add_network
(
char
*
ifname
);
struct
network
*
add_network
(
char
*
ifname
);
int
network_idle
(
struct
network
*
net
);
int
network_idle
(
struct
network
*
net
);
int
update_hello_interval
(
struct
network
*
net
);
int
update_hello_interval
(
struct
network
*
net
);
unsigned
int
jitter
(
struct
network
*
net
);
unsigned
int
jitter
(
struct
network
*
net
,
int
urgent
);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
unsigned
int
update_jitter
(
struct
network
*
net
,
int
urgent
);
void
delay_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
);
void
delay_jitter
(
struct
timeval
*
time
,
struct
timeval
*
timeout
,
int
msecs
);
int
network_up
(
struct
network
*
net
,
int
up
);
int
network_up
(
struct
network
*
net
,
int
up
);
...
...
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