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
6802457e
Commit
6802457e
authored
May 19, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use FOR_ALL_NETS in babel.c.
parent
8bd2024d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
43 deletions
+44
-43
babel.c
babel.c
+44
-43
No files found.
babel.c
View file @
6802457e
...
@@ -105,6 +105,7 @@ main(int argc, char **argv)
...
@@ -105,6 +105,7 @@ main(int argc, char **argv)
void
*
vrc
;
void
*
vrc
;
unsigned
int
seed
;
unsigned
int
seed
;
char
**
arg
;
char
**
arg
;
struct
network
*
net
;
parse_address
(
"ff02::cca6:c0f9:e182:5373"
,
protocol_group
,
NULL
);
parse_address
(
"ff02::cca6:c0f9:e182:5373"
,
protocol_group
,
NULL
);
protocol_port
=
8475
;
protocol_port
=
8475
;
...
@@ -514,17 +515,17 @@ main(int argc, char **argv)
...
@@ -514,17 +515,17 @@ main(int argc, char **argv)
source_expiry_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
source_expiry_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
/* Make some noise so that others notice us */
/* Make some noise so that others notice us */
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
/* Apply jitter before we send the first message. */
/* Apply jitter before we send the first message. */
usleep
(
5000
+
random
()
%
10000
);
usleep
(
5000
+
random
()
%
10000
);
gettimeofday
(
&
now
,
NULL
);
gettimeofday
(
&
now
,
NULL
);
send_hello
(
&
nets
[
i
]
);
send_hello
(
net
);
send_self_update
(
&
nets
[
i
]
,
0
);
send_self_update
(
net
,
0
);
send_request
(
&
nets
[
i
]
,
NULL
,
0
,
0
,
0
,
0
);
send_request
(
net
,
NULL
,
0
,
0
,
0
,
0
);
flushupdates
();
flushupdates
();
flushbuf
(
&
nets
[
i
]
);
flushbuf
(
net
);
}
}
debugf
(
"Entering main loop.
\n
"
);
debugf
(
"Entering main loop.
\n
"
);
...
@@ -540,14 +541,14 @@ main(int argc, char **argv)
...
@@ -540,14 +541,14 @@ main(int argc, char **argv)
timeval_min_sec
(
&
tv
,
source_expiry_time
);
timeval_min_sec
(
&
tv
,
source_expiry_time
);
timeval_min_sec
(
&
tv
,
kernel_dump_time
);
timeval_min_sec
(
&
tv
,
kernel_dump_time
);
timeval_min
(
&
tv
,
&
resend_time
);
timeval_min
(
&
tv
,
&
resend_time
);
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
timeval_min
(
&
tv
,
&
net
s
[
i
].
flush_timeout
);
timeval_min
(
&
tv
,
&
net
->
flush_timeout
);
timeval_min
(
&
tv
,
&
net
s
[
i
].
hello_timeout
);
timeval_min
(
&
tv
,
&
net
->
hello_timeout
);
if
(
!
network_idle
(
&
nets
[
i
]
))
{
if
(
!
network_idle
(
net
))
{
timeval_min
(
&
tv
,
&
net
s
[
i
].
self_update_timeout
);
timeval_min
(
&
tv
,
&
net
->
self_update_timeout
);
timeval_min
(
&
tv
,
&
net
s
[
i
].
update_timeout
);
timeval_min
(
&
tv
,
&
net
->
update_timeout
);
}
}
}
}
timeval_min
(
&
tv
,
&
update_flush_timeout
);
timeval_min
(
&
tv
,
&
update_flush_timeout
);
...
@@ -591,11 +592,11 @@ main(int argc, char **argv)
...
@@ -591,11 +592,11 @@ main(int argc, char **argv)
usleep
(
1000000
);
usleep
(
1000000
);
}
}
}
else
{
}
else
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
if
(
net
s
[
i
].
ifindex
==
sin6
.
sin6_scope_id
)
{
if
(
net
->
ifindex
==
sin6
.
sin6_scope_id
)
{
parse_packet
((
unsigned
char
*
)
&
sin6
.
sin6_addr
,
&
nets
[
i
]
,
parse_packet
((
unsigned
char
*
)
&
sin6
.
sin6_addr
,
net
,
receive_buffer
,
rc
);
receive_buffer
,
rc
);
VALGRIND_MAKE_MEM_UNDEFINED
(
receive_buffer
,
VALGRIND_MAKE_MEM_UNDEFINED
(
receive_buffer
,
receive_buffer_size
);
receive_buffer_size
);
...
@@ -653,16 +654,16 @@ main(int argc, char **argv)
...
@@ -653,16 +654,16 @@ main(int argc, char **argv)
source_expiry_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
source_expiry_time
=
now
.
tv_sec
+
200
+
random
()
%
200
;
}
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
if
(
timeval_compare
(
&
now
,
&
net
s
[
i
].
hello_timeout
)
>=
0
)
if
(
timeval_compare
(
&
now
,
&
net
->
hello_timeout
)
>=
0
)
send_hello
(
&
nets
[
i
]
);
send_hello
(
net
);
if
(
!
network_idle
(
&
nets
[
i
]
))
{
if
(
!
network_idle
(
net
))
{
if
(
timeval_compare
(
&
now
,
&
net
s
[
i
].
update_timeout
)
>=
0
)
if
(
timeval_compare
(
&
now
,
&
net
->
update_timeout
)
>=
0
)
send_update
(
&
nets
[
i
]
,
0
,
NULL
,
0
);
send_update
(
net
,
0
,
NULL
,
0
);
if
(
timeval_compare
(
&
now
,
&
net
s
[
i
].
self_update_timeout
)
>=
0
)
if
(
timeval_compare
(
&
now
,
&
net
->
self_update_timeout
)
>=
0
)
send_self_update
(
&
nets
[
i
]
,
0
);
send_self_update
(
net
,
0
);
}
}
}
}
...
@@ -681,12 +682,12 @@ main(int argc, char **argv)
...
@@ -681,12 +682,12 @@ main(int argc, char **argv)
flush_unicast
(
1
);
flush_unicast
(
1
);
}
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
if
(
net
s
[
i
].
flush_timeout
.
tv_sec
!=
0
)
{
if
(
net
->
flush_timeout
.
tv_sec
!=
0
)
{
if
(
timeval_compare
(
&
now
,
&
net
s
[
i
].
flush_timeout
)
>=
0
)
if
(
timeval_compare
(
&
now
,
&
net
->
flush_timeout
)
>=
0
)
flushbuf
(
&
nets
[
i
]
);
flushbuf
(
net
);
}
}
}
}
...
@@ -717,26 +718,26 @@ main(int argc, char **argv)
...
@@ -717,26 +718,26 @@ main(int argc, char **argv)
flushupdates
();
flushupdates
();
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
/* Make sure that we expire quickly from our neighbours'
/* Make sure that we expire quickly from our neighbours'
association caches. Since we sleep on average 10ms per
association caches. Since we sleep on average 10ms per
network, set the hello interval to numnets centiseconds. */
network, set the hello interval to numnets centiseconds. */
send_hello_noupdate
(
&
nets
[
i
]
,
numnets
);
send_hello_noupdate
(
net
,
numnets
);
flushbuf
(
&
nets
[
i
]
);
flushbuf
(
net
);
usleep
(
5000
+
random
()
%
10000
);
usleep
(
5000
+
random
()
%
10000
);
gettimeofday
(
&
now
,
NULL
);
gettimeofday
(
&
now
,
NULL
);
}
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
nets
[
i
].
up
)
if
(
net
->
up
)
continue
;
continue
;
/* Make sure they got it. */
/* Make sure they got it. */
send_hello_noupdate
(
&
nets
[
i
]
,
1
);
send_hello_noupdate
(
net
,
1
);
flushbuf
(
&
nets
[
i
]
);
flushbuf
(
net
);
usleep
(
5000
+
random
()
%
10000
);
usleep
(
5000
+
random
()
%
10000
);
gettimeofday
(
&
now
,
NULL
);
gettimeofday
(
&
now
,
NULL
);
network_up
(
&
nets
[
i
]
,
0
);
network_up
(
net
,
0
);
}
}
kernel_setup_socket
(
0
);
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
kernel_setup
(
0
);
...
@@ -788,10 +789,10 @@ main(int argc, char **argv)
...
@@ -788,10 +789,10 @@ main(int argc, char **argv)
if
(
pidfile
)
if
(
pidfile
)
unlink
(
pidfile
);
unlink
(
pidfile
);
fail_nopid:
fail_nopid:
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
FOR_ALL_NETS
(
net
)
{
if
(
!
net
s
[
i
].
up
)
if
(
!
net
->
up
)
continue
;
continue
;
network_up
(
&
nets
[
i
]
,
0
);
network_up
(
net
,
0
);
}
}
kernel_setup_socket
(
0
);
kernel_setup_socket
(
0
);
kernel_setup
(
0
);
kernel_setup
(
0
);
...
...
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