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
19bcf631
Commit
19bcf631
authored
Jul 03, 2015
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify babel-state to just contain a seqno.
This is simpler and avoids issues with changing router-ids.
parent
3948b483
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
25 deletions
+6
-25
babeld.c
babeld.c
+6
-25
No files found.
babeld.c
View file @
19bcf631
...
@@ -442,30 +442,15 @@ main(int argc, char **argv)
...
@@ -442,30 +442,15 @@ main(int argc, char **argv)
}
}
if
(
fd
>=
0
)
{
if
(
fd
>=
0
)
{
char
buf
[
100
];
char
buf
[
100
];
char
buf2
[
100
];
int
s
;
int
s
;
long
t
;
rc
=
read
(
fd
,
buf
,
99
);
rc
=
read
(
fd
,
buf
,
99
);
if
(
rc
<
0
)
{
if
(
rc
<
0
)
{
perror
(
"read(babel-state)"
);
perror
(
"read(babel-state)"
);
}
else
{
}
else
{
buf
[
rc
]
=
'\0'
;
buf
[
rc
]
=
'\0'
;
rc
=
sscanf
(
buf
,
"%99s %d %ld
\n
"
,
buf2
,
&
s
,
&
t
);
rc
=
sscanf
(
buf
,
"%d
\n
"
,
&
s
);
if
(
rc
==
3
&&
s
>=
0
&&
s
<=
0xFFFF
)
{
if
(
rc
==
1
&&
s
>=
0
&&
s
<=
0xFFFF
)
{
unsigned
char
sid
[
8
];
myseqno
=
seqno_plus
(
s
,
1
);
rc
=
parse_eui64
(
buf2
,
sid
);
if
(
rc
<
0
)
{
fprintf
(
stderr
,
"Couldn't parse babel-state.
\n
"
);
}
else
{
struct
timeval
realnow
;
debugf
(
"Got %s %d %ld from babel-state.
\n
"
,
format_eui64
(
sid
),
s
,
t
);
gettimeofday
(
&
realnow
,
NULL
);
if
(
memcmp
(
sid
,
myid
,
8
)
==
0
)
myseqno
=
seqno_plus
(
s
,
1
);
else
if
(
!
random_id
)
fprintf
(
stderr
,
"ID mismatch in babel-state.
\n
"
);
}
}
else
{
}
else
{
fprintf
(
stderr
,
"Couldn't parse babel-state.
\n
"
);
fprintf
(
stderr
,
"Couldn't parse babel-state.
\n
"
);
}
}
...
@@ -775,13 +760,9 @@ main(int argc, char **argv)
...
@@ -775,13 +760,9 @@ main(int argc, char **argv)
perror
(
"creat(babel-state)"
);
perror
(
"creat(babel-state)"
);
unlink
(
state_file
);
unlink
(
state_file
);
}
else
{
}
else
{
struct
timeval
realnow
;
char
buf
[
10
];
char
buf
[
100
];
rc
=
snprintf
(
buf
,
10
,
"%d
\n
"
,
(
int
)
myseqno
);
gettimeofday
(
&
realnow
,
NULL
);
if
(
rc
<
0
||
rc
>=
10
)
{
rc
=
snprintf
(
buf
,
100
,
"%s %d %ld
\n
"
,
format_eui64
(
myid
),
(
int
)
myseqno
,
(
long
)
realnow
.
tv_sec
);
if
(
rc
<
0
||
rc
>=
100
)
{
fprintf
(
stderr
,
"write(babel-state): overflow.
\n
"
);
fprintf
(
stderr
,
"write(babel-state): overflow.
\n
"
);
unlink
(
state_file
);
unlink
(
state_file
);
}
else
{
}
else
{
...
...
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