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)
...
@@ -528,14 +528,14 @@ main(int argc, char **argv)
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
!
nets
[
i
].
up
)
if
(
!
nets
[
i
].
up
)
continue
;
continue
;
timeval_min
(
&
tv
,
&
nets
[
i
].
flush_time
);
timeval_min
(
&
tv
,
&
nets
[
i
].
flush_time
out
);
timeval_min
(
&
tv
,
&
nets
[
i
].
hello_timeout
);
timeval_min
(
&
tv
,
&
nets
[
i
].
hello_timeout
);
if
(
!
network_idle
(
&
nets
[
i
]))
{
if
(
!
network_idle
(
&
nets
[
i
]))
{
timeval_min
(
&
tv
,
&
nets
[
i
].
self_update_timeout
);
timeval_min
(
&
tv
,
&
nets
[
i
].
self_update_timeout
);
timeval_min
(
&
tv
,
&
nets
[
i
].
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
);
FD_ZERO
(
&
readfds
);
if
(
timeval_compare
(
&
tv
,
&
now
)
>
0
)
{
if
(
timeval_compare
(
&
tv
,
&
now
)
>
0
)
{
timeval_minus
(
&
tv
,
&
tv
,
&
now
);
timeval_minus
(
&
tv
,
&
tv
,
&
now
);
...
@@ -653,16 +653,16 @@ main(int argc, char **argv)
...
@@ -653,16 +653,16 @@ main(int argc, char **argv)
if
(
now
.
tv_sec
>=
request_resend_time
)
if
(
now
.
tv_sec
>=
request_resend_time
)
resend_requests
();
resend_requests
();
if
(
update_flush_time
.
tv_sec
!=
0
)
{
if
(
update_flush_time
out
.
tv_sec
!=
0
)
{
if
(
now
.
tv_sec
>=
update_flush_time
.
tv_sec
)
if
(
now
.
tv_sec
>=
update_flush_time
out
.
tv_sec
)
flushupdates
();
flushupdates
();
}
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
!
nets
[
i
].
up
)
if
(
!
nets
[
i
].
up
)
continue
;
continue
;
if
(
nets
[
i
].
flush_time
.
tv_sec
!=
0
)
{
if
(
nets
[
i
].
flush_time
out
.
tv_sec
!=
0
)
{
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
flush_time
)
>=
0
)
if
(
timeval_compare
(
&
now
,
&
nets
[
i
].
flush_time
out
)
>=
0
)
flushbuf
(
&
nets
[
i
]);
flushbuf
(
&
nets
[
i
]);
}
}
}
}
...
...
message.c
View file @
3580913a
...
@@ -39,7 +39,7 @@ THE SOFTWARE.
...
@@ -39,7 +39,7 @@ THE SOFTWARE.
#include "message.h"
#include "message.h"
#include "filter.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
};
const
unsigned
char
packet_header
[
8
]
=
{
42
,
1
};
...
@@ -361,19 +361,19 @@ flushbuf(struct network *net)
...
@@ -361,19 +361,19 @@ flushbuf(struct network *net)
}
}
VALGRIND_MAKE_MEM_UNDEFINED
(
net
->
sendbuf
,
net
->
bufsize
);
VALGRIND_MAKE_MEM_UNDEFINED
(
net
->
sendbuf
,
net
->
bufsize
);
net
->
buffered
=
0
;
net
->
buffered
=
0
;
net
->
flush_time
.
tv_sec
=
0
;
net
->
flush_time
out
.
tv_sec
=
0
;
net
->
flush_time
.
tv_usec
=
0
;
net
->
flush_time
out
.
tv_usec
=
0
;
}
}
static
void
static
void
schedule_flush
(
struct
network
*
net
)
schedule_flush
(
struct
network
*
net
)
{
{
int
msecs
=
jitter
(
net
);
int
msecs
=
jitter
(
net
);
if
(
net
->
flush_time
.
tv_sec
!=
0
&&
if
(
net
->
flush_time
out
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_time
,
&
now
)
<
msecs
)
timeval_minus_msec
(
&
net
->
flush_time
out
,
&
now
)
<
msecs
)
return
;
return
;
net
->
flush_time
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
net
->
flush_time
out
.
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_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
}
}
void
void
...
@@ -381,11 +381,12 @@ schedule_flush_now(struct network *net)
...
@@ -381,11 +381,12 @@ schedule_flush_now(struct network *net)
{
{
/* Almost now */
/* Almost now */
int
msecs
=
5
+
random
()
%
5
;
int
msecs
=
5
+
random
()
%
5
;
if
(
net
->
flush_time
.
tv_sec
!=
0
&&
if
(
net
->
flush_time
out
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
net
->
flush_time
,
&
now
)
<
msecs
)
timeval_minus_msec
(
&
net
->
flush_time
out
,
&
now
)
<
msecs
)
return
;
return
;
net
->
flush_time
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
net
->
flush_timeout
.
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_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
}
}
static
void
static
void
...
@@ -674,8 +675,8 @@ flushupdates(void)
...
@@ -674,8 +675,8 @@ flushupdates(void)
VALGRIND_MAKE_MEM_UNDEFINED
(
&
buffered_updates
,
VALGRIND_MAKE_MEM_UNDEFINED
(
&
buffered_updates
,
sizeof
(
buffered_updates
));
sizeof
(
buffered_updates
));
}
}
update_flush_time
.
tv_sec
=
0
;
update_flush_time
out
.
tv_sec
=
0
;
update_flush_time
.
tv_usec
=
0
;
update_flush_time
out
.
tv_usec
=
0
;
}
}
static
void
static
void
...
@@ -683,11 +684,12 @@ schedule_update_flush(struct network *net, int urgent)
...
@@ -683,11 +684,12 @@ schedule_update_flush(struct network *net, int urgent)
{
{
int
msecs
;
int
msecs
;
msecs
=
update_jitter
(
net
,
urgent
);
msecs
=
update_jitter
(
net
,
urgent
);
if
(
update_flush_time
.
tv_sec
!=
0
&&
if
(
update_flush_time
out
.
tv_sec
!=
0
&&
timeval_minus_msec
(
&
update_flush_time
,
&
now
)
<
msecs
)
timeval_minus_msec
(
&
update_flush_time
out
,
&
now
)
<
msecs
)
return
;
return
;
update_flush_time
.
tv_usec
=
(
now
.
tv_usec
+
msecs
*
1000
)
%
1000000
;
update_flush_timeout
.
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_sec
=
now
.
tv_sec
+
(
now
.
tv_usec
/
1000
+
msecs
)
/
1000
;
}
}
static
void
static
void
...
...
message.h
View file @
3580913a
...
@@ -31,7 +31,7 @@ extern int silent_time;
...
@@ -31,7 +31,7 @@ extern int silent_time;
extern
int
broadcast_ihu
;
extern
int
broadcast_ihu
;
extern
int
split_horizon
;
extern
int
split_horizon
;
extern
struct
timeval
update_flush_time
;
extern
struct
timeval
update_flush_time
out
;
extern
const
unsigned
char
packet_header
[
8
];
extern
const
unsigned
char
packet_header
[
8
];
unsigned
short
hash_id
(
const
unsigned
char
*
id
)
ATTRIBUTE
((
pure
));
unsigned
short
hash_id
(
const
unsigned
char
*
id
)
ATTRIBUTE
((
pure
));
...
...
network.h
View file @
3580913a
...
@@ -36,7 +36,7 @@ struct network {
...
@@ -36,7 +36,7 @@ struct network {
char
ifname
[
IF_NAMESIZE
];
char
ifname
[
IF_NAMESIZE
];
unsigned
char
*
ipv4
;
unsigned
char
*
ipv4
;
int
buffered
;
int
buffered
;
struct
timeval
flush_time
;
struct
timeval
flush_time
out
;
int
bufsize
;
int
bufsize
;
unsigned
char
*
sendbuf
;
unsigned
char
*
sendbuf
;
int
bucket_time
;
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