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
2b5685c6
Commit
2b5685c6
authored
Mar 13, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a timeval for request_resend_time.
parent
e278342e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
18 deletions
+12
-18
babel.c
babel.c
+2
-3
request.c
request.c
+8
-13
request.h
request.h
+2
-2
No files found.
babel.c
View file @
2b5685c6
...
@@ -531,8 +531,7 @@ main(int argc, char **argv)
...
@@ -531,8 +531,7 @@ main(int argc, char **argv)
tv
=
check_neighbours_time
;
tv
=
check_neighbours_time
;
timeval_min_sec
(
&
tv
,
expiry_time
);
timeval_min_sec
(
&
tv
,
expiry_time
);
if
(
request_resend_time
)
timeval_min
(
&
tv
,
&
request_resend_time
);
timeval_min_sec
(
&
tv
,
request_resend_time
);
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
if
(
!
nets
[
i
].
up
)
if
(
!
nets
[
i
].
up
)
continue
;
continue
;
...
@@ -658,7 +657,7 @@ main(int argc, char **argv)
...
@@ -658,7 +657,7 @@ main(int argc, char **argv)
}
}
}
}
if
(
now
.
tv_sec
>=
request_resend_time
)
if
(
timeval_compare
(
&
now
,
&
request_resend_time
)
>=
0
)
resend_requests
();
resend_requests
();
if
(
update_flush_timeout
.
tv_sec
!=
0
)
{
if
(
update_flush_timeout
.
tv_sec
!=
0
)
{
...
...
request.c
View file @
2b5685c6
...
@@ -33,7 +33,7 @@ THE SOFTWARE.
...
@@ -33,7 +33,7 @@ THE SOFTWARE.
#include "network.h"
#include "network.h"
#include "filter.h"
#include "filter.h"
int
request_resend_time
=
0
;
struct
timeval
request_resend_time
=
{
0
,
0
}
;
struct
request
*
recorded_requests
=
NULL
;
struct
request
*
recorded_requests
=
NULL
;
static
int
static
int
...
@@ -83,7 +83,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
...
@@ -83,7 +83,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
else
if
(
resend
)
else
if
(
resend
)
request
->
resend
=
resend
;
request
->
resend
=
resend
;
request
->
time
=
now
.
tv_sec
;
request
->
time
=
now
.
tv_sec
;
request_resend_time
=
MIN
(
request_resend_time
,
timeval_min_sec
(
&
request_resend_time
,
request
->
time
+
request
->
resend
);
request
->
time
+
request
->
resend
);
if
(
request
->
router_hash
==
router_hash
&&
if
(
request
->
router_hash
==
router_hash
&&
seqno_compare
(
request
->
seqno
,
seqno
)
>
0
)
{
seqno_compare
(
request
->
seqno
,
seqno
)
>
0
)
{
...
@@ -107,7 +107,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
...
@@ -107,7 +107,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
request
->
time
=
now
.
tv_sec
;
request
->
time
=
now
.
tv_sec
;
request
->
resend
=
resend
;
request
->
resend
=
resend
;
if
(
resend
)
if
(
resend
)
request_resend_time
=
MIN
(
request_resend_time
,
now
.
tv_sec
+
resend
);
timeval_min_sec
(
&
request_resend_time
,
now
.
tv_sec
+
resend
);
request
->
next
=
recorded_requests
;
request
->
next
=
recorded_requests
;
recorded_requests
=
request
;
recorded_requests
=
request
;
return
1
;
return
1
;
...
@@ -187,25 +187,20 @@ expire_requests()
...
@@ -187,25 +187,20 @@ expire_requests()
recompute_request_resend_time
();
recompute_request_resend_time
();
}
}
int
void
recompute_request_resend_time
()
recompute_request_resend_time
()
{
{
struct
request
*
request
;
struct
request
*
request
;
int
resend
=
0
;
struct
timeval
resend
=
{
0
,
0
}
;
request
=
recorded_requests
;
request
=
recorded_requests
;
while
(
request
)
{
while
(
request
)
{
if
(
request
->
resend
)
{
if
(
request
->
resend
)
if
(
resend
)
timeval_min_sec
(
&
resend
,
request
->
time
+
request
->
resend
);
resend
=
MIN
(
resend
,
request
->
time
+
request
->
resend
);
else
resend
=
request
->
time
+
request
->
resend
;
}
request
=
request
->
next
;
request
=
request
->
next
;
}
}
request_resend_time
=
resend
;
request_resend_time
=
resend
;
return
resend
;
}
}
void
void
...
...
request.h
View file @
2b5685c6
...
@@ -33,7 +33,7 @@ struct request {
...
@@ -33,7 +33,7 @@ struct request {
struct
request
*
next
;
struct
request
*
next
;
};
};
extern
int
request_resend_time
;
extern
struct
timeval
request_resend_time
;
struct
request
*
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
request
*
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
request
**
previous_return
);
struct
request
**
previous_return
);
...
@@ -47,5 +47,5 @@ int satisfy_request(const unsigned char *prefix, unsigned char plen,
...
@@ -47,5 +47,5 @@ int satisfy_request(const unsigned char *prefix, unsigned char plen,
struct
network
*
net
);
struct
network
*
net
);
void
expire_requests
(
void
);
void
expire_requests
(
void
);
int
recompute_request_resend_time
(
void
);
void
recompute_request_resend_time
(
void
);
void
resend_requests
(
void
);
void
resend_requests
(
void
);
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