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
3580913a
Commit
3580913a
authored
Mar 13, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename flush_time to flush_timeout for consistency.
parent
f3ed6390
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
25 deletions
+27
-25
babel.c
babel.c
+6
-6
message.c
message.c
+19
-17
message.h
message.h
+1
-1
network.h
network.h
+1
-1
No files found.
babel.c
View file @
3580913a
...
...
@@ -528,14 +528,14 @@ main(int argc, char **argv)
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
!
nets
[
i
].
up
)
continue
;
timeval_min
(
&
tv
,
&
nets
[
i
].
flush_time
);
timeval_min
(
&
tv
,
&
nets
[
i
].
flush_time
out
);
timeval_min
(
&
tv
,
&
nets
[
i
].
hello_timeout
);
if
(
!
network_idle
(
&
nets
[
i
]))
{
timeval_min
(
&
tv
,
&
nets
[
i
].
self_update_timeout
);
timeval_min
(
&
tv
,
&
nets
[
i
].
update_timeout
);
}
}
timeval_min
(
&
tv
,
&
update_flush_time
);
timeval_min
(
&
tv
,
&
update_flush_time
out
);
FD_ZERO
(
&
readfds
);
if
(
timeval_compare
(
&
tv
,
&
now
)
>
0
)
{
timeval_minus
(
&
tv
,
&
tv
,
&
now
);
...
...
@@ -653,16 +653,16 @@ main(int argc, char **argv)
if
(
now
.
tv_sec
>=
request_resend_time
)
resend_requests
();
if
(
update_flush_time
.
tv_sec
!=
0
)
{
if
(
now
.
tv_sec
>=
update_flush_time
.
tv_sec
)
if
(
update_flush_time
out
.
tv_sec
!=
0
)
{
if
(
now
.
tv_sec
>=
update_flush_time
out
.
tv_sec
)
flushupdates
();
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
!
nets
[
i
].
up
)
continue
;
if
(
nets
[
i
].
flush_time
.
tv_sec
!=
0
)
{
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
flush_time
)
>=
0
)
if
(
nets
[
i
].
flush_time
out
.
tv_sec
!=
0
)
{
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
flush_time
out
)
>=
0
)
flushbuf
(
&
nets
[
i
]);
}
}
...
...
message.c
View file @
3580913a
...
...
@@ -39,7 +39,7 @@ THE SOFTWARE.
#include "message.h"
#include "filter.h"
struct
timeval
update_flush_time
=
{
0
,
0
};
struct
timeval
update_flush_time
out
=
{
0
,
0
};
const
unsigned
char
packet_header
[
8
]
=
{
42
,
1
};
...
...
@@ -361,19 +361,19 @@ flushbuf(struct network *net)
}
VALGRIND_MAKE_MEM_UNDEFINED
(
net
->
sendbuf
,
net
->
bufsize
);
net
->
buffered
=
0
;
net
->
flush_time
.
tv_sec
=
0
;
net
->
flush_time
.
tv_usec
=
0
;
net
->
flush_time
out
.
tv_sec
=
0
;
net
->
flush_time
out
.
tv_usec
=
0
;
}
static
void
schedule_flush
(
struct
network
*
net
)
{
int
msecs
=
jitter
(
net
);
if
(
net
->
flush_time
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_time
,
&
now
)
<
msecs
)
if
(
net
->
flush_time
out
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_time
out
,
&
now
)
<
msecs
)
return
;
net
->
flush_time
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
net
->
flush_time
.
tv_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
net
->
flush_time
out
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
net
->
flush_time
out
.
tv_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
}
void
...
...
@@ -381,11 +381,12 @@ schedule_flush_now(struct network *net)
{
/* Almost now */
int
msecs
=
5
+
random
()
%
5
;
if
(
net
->
flush_time
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_time
,
&
now
)
<
msecs
)
if
(
net
->
flush_time
out
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_time
out
,
&
now
)
<
msecs
)
return
;
net
->
flush_time
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
net
->
flush_time
.
tv_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
net
->
flush_timeout
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
net
->
flush_timeout
.
tv_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
}
static
void
...
...
@@ -674,8 +675,8 @@ flushupdates(void)
VALGRIND_MAKE_MEM_UNDEFINED
(
&
buffered_updates
,
sizeof
(
buffered_updates
));
}
update_flush_time
.
tv_sec
=
0
;
update_flush_time
.
tv_usec
=
0
;
update_flush_time
out
.
tv_sec
=
0
;
update_flush_time
out
.
tv_usec
=
0
;
}
static
void
...
...
@@ -683,11 +684,12 @@ schedule_update_flush(struct network *net, int urgent)
{
int
msecs
;
msecs
=
update_jitter
(
net
,
urgent
);
if
(
update_flush_time
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
update_flush_time
,
&
now
)
<
msecs
)
if
(
update_flush_time
out
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
update_flush_time
out
,
&
now
)
<
msecs
)
return
;
update_flush_time
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
update_flush_time
.
tv_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
update_flush_timeout
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
update_flush_timeout
.
tv_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
}
static
void
...
...
message.h
View file @
3580913a
...
...
@@ -31,7 +31,7 @@ extern int silent_time;
extern
int
broadcast_ihu
;
extern
int
split_horizon
;
extern
struct
timeval
update_flush_time
;
extern
struct
timeval
update_flush_time
out
;
extern
const
unsigned
char
packet_header
[
8
];
unsigned
short
hash_id
(
const
unsigned
char
*
id
)
ATTRIBUTE
((
pure
));
...
...
network.h
View file @
3580913a
...
...
@@ -36,7 +36,7 @@ struct network {
char
ifname
[
IF_NAMESIZE
];
unsigned
char
*
ipv4
;
int
buffered
;
struct
timeval
flush_time
;
struct
timeval
flush_time
out
;
int
bufsize
;
unsigned
char
*
sendbuf
;
int
bucket_time
;
...
...
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