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
25ddad56
Commit
25ddad56
authored
Mar 31, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename struct request to resend.
parent
8a5109b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
message.c
message.c
+1
-1
resend.c
resend.c
+21
-21
resend.h
resend.h
+4
-4
No files found.
message.c
View file @
25ddad56
...
@@ -834,7 +834,7 @@ send_update(struct network *net, int urgent,
...
@@ -834,7 +834,7 @@ send_update(struct network *net, int urgent,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
{
{
int
i
,
selfonly
;
int
i
,
selfonly
;
struct
re
quest
*
request
;
struct
re
send
*
request
;
if
(
prefix
)
{
if
(
prefix
)
{
/* This is needed here, since really_send_update only handles the
/* This is needed here, since really_send_update only handles the
...
...
resend.c
View file @
25ddad56
...
@@ -34,23 +34,23 @@ THE SOFTWARE.
...
@@ -34,23 +34,23 @@ THE SOFTWARE.
#include "filter.h"
#include "filter.h"
struct
timeval
resend_time
=
{
0
,
0
};
struct
timeval
resend_time
=
{
0
,
0
};
struct
re
quest
*
recorded_requests
=
NULL
;
struct
re
send
*
to_resend
=
NULL
;
static
int
static
int
request_match
(
struct
re
quest
*
request
,
request_match
(
struct
re
send
*
request
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
{
{
return
request
->
plen
==
plen
&&
memcmp
(
request
->
prefix
,
prefix
,
16
)
==
0
;
return
request
->
plen
==
plen
&&
memcmp
(
request
->
prefix
,
prefix
,
16
)
==
0
;
}
}
struct
re
quest
*
struct
re
send
*
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
re
quest
**
previous_return
)
struct
re
send
**
previous_return
)
{
{
struct
re
quest
*
request
,
*
previous
;
struct
re
send
*
request
,
*
previous
;
previous
=
NULL
;
previous
=
NULL
;
request
=
recorded_requests
;
request
=
to_resend
;
while
(
request
)
{
while
(
request
)
{
if
(
request_match
(
request
,
prefix
,
plen
))
{
if
(
request_match
(
request
,
prefix
,
plen
))
{
if
(
previous_return
)
if
(
previous_return
)
...
@@ -69,7 +69,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
...
@@ -69,7 +69,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
unsigned
short
seqno
,
unsigned
short
router_hash
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
struct
network
*
network
,
int
resend
)
struct
network
*
network
,
int
resend
)
{
{
struct
re
quest
*
request
;
struct
re
send
*
request
;
unsigned
int
ifindex
=
network
?
network
->
ifindex
:
0
;
unsigned
int
ifindex
=
network
?
network
->
ifindex
:
0
;
if
(
input_filter
(
NULL
,
prefix
,
plen
,
NULL
,
ifindex
)
>=
INFINITY
||
if
(
input_filter
(
NULL
,
prefix
,
plen
,
NULL
,
ifindex
)
>=
INFINITY
||
...
@@ -92,7 +92,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
...
@@ -92,7 +92,7 @@ record_request(const unsigned char *prefix, unsigned char plen,
if
(
request
->
network
!=
network
)
if
(
request
->
network
!=
network
)
request
->
network
=
NULL
;
request
->
network
=
NULL
;
}
else
{
}
else
{
request
=
malloc
(
sizeof
(
struct
re
quest
));
request
=
malloc
(
sizeof
(
struct
re
send
));
if
(
request
==
NULL
)
if
(
request
==
NULL
)
return
-
1
;
return
-
1
;
memcpy
(
request
->
prefix
,
prefix
,
16
);
memcpy
(
request
->
prefix
,
prefix
,
16
);
...
@@ -102,8 +102,8 @@ record_request(const unsigned char *prefix, unsigned char plen,
...
@@ -102,8 +102,8 @@ record_request(const unsigned char *prefix, unsigned char plen,
request
->
network
=
network
;
request
->
network
=
network
;
request
->
time
=
now
;
request
->
time
=
now
;
request
->
resend
=
resend
;
request
->
resend
=
resend
;
request
->
next
=
recorded_requests
;
request
->
next
=
to_resend
;
recorded_requests
=
request
;
to_resend
=
request
;
}
}
if
(
request
->
resend
)
{
if
(
request
->
resend
)
{
...
@@ -118,7 +118,7 @@ int
...
@@ -118,7 +118,7 @@ int
unsatisfied_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsatisfied_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
router_hash
)
unsigned
short
seqno
,
unsigned
short
router_hash
)
{
{
struct
re
quest
*
request
;
struct
re
send
*
request
;
request
=
find_request
(
prefix
,
plen
,
NULL
);
request
=
find_request
(
prefix
,
plen
,
NULL
);
if
(
request
==
NULL
)
if
(
request
==
NULL
)
...
@@ -136,7 +136,7 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
...
@@ -136,7 +136,7 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
unsigned
short
seqno
,
unsigned
short
router_hash
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
struct
network
*
network
)
struct
network
*
network
)
{
{
struct
re
quest
*
request
,
*
previous
;
struct
re
send
*
request
,
*
previous
;
request
=
find_request
(
prefix
,
plen
,
&
previous
);
request
=
find_request
(
prefix
,
plen
,
&
previous
);
if
(
request
==
NULL
)
if
(
request
==
NULL
)
...
@@ -148,7 +148,7 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
...
@@ -148,7 +148,7 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
if
(
request
->
router_hash
!=
router_hash
||
if
(
request
->
router_hash
!=
router_hash
||
seqno_compare
(
request
->
seqno
,
seqno
)
<=
0
)
{
seqno_compare
(
request
->
seqno
,
seqno
)
<=
0
)
{
if
(
previous
==
NULL
)
if
(
previous
==
NULL
)
recorded_requests
=
request
->
next
;
to_resend
=
request
->
next
;
else
else
previous
->
next
=
request
->
next
;
previous
->
next
=
request
->
next
;
free
(
request
);
free
(
request
);
...
@@ -162,17 +162,17 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
...
@@ -162,17 +162,17 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
void
void
expire_requests
()
expire_requests
()
{
{
struct
re
quest
*
request
,
*
previous
;
struct
re
send
*
request
,
*
previous
;
int
recompute
=
0
;
int
recompute
=
0
;
previous
=
NULL
;
previous
=
NULL
;
request
=
recorded_requests
;
request
=
to_resend
;
while
(
request
)
{
while
(
request
)
{
if
(
timeval_minus_msec
(
&
now
,
&
request
->
time
)
>=
REQUEST_TIMEOUT
)
{
if
(
timeval_minus_msec
(
&
now
,
&
request
->
time
)
>=
REQUEST_TIMEOUT
)
{
if
(
previous
==
NULL
)
{
if
(
previous
==
NULL
)
{
recorded_requests
=
request
->
next
;
to_resend
=
request
->
next
;
free
(
request
);
free
(
request
);
request
=
recorded_requests
;
request
=
to_resend
;
}
else
{
}
else
{
previous
->
next
=
request
->
next
;
previous
->
next
=
request
->
next
;
free
(
request
);
free
(
request
);
...
@@ -190,10 +190,10 @@ expire_requests()
...
@@ -190,10 +190,10 @@ expire_requests()
void
void
recompute_resend_time
()
recompute_resend_time
()
{
{
struct
re
quest
*
request
;
struct
re
send
*
request
;
struct
timeval
resend
=
{
0
,
0
};
struct
timeval
resend
=
{
0
,
0
};
request
=
recorded_requests
;
request
=
to_resend
;
while
(
request
)
{
while
(
request
)
{
if
(
request
->
resend
)
{
if
(
request
->
resend
)
{
struct
timeval
timeout
;
struct
timeval
timeout
;
...
@@ -209,9 +209,9 @@ recompute_resend_time()
...
@@ -209,9 +209,9 @@ recompute_resend_time()
void
void
do_resend
()
do_resend
()
{
{
struct
re
quest
*
request
;
struct
re
send
*
request
;
request
=
recorded_requests
;
request
=
to_resend
;
while
(
request
)
{
while
(
request
)
{
if
(
request
->
resend
)
{
if
(
request
->
resend
)
{
struct
timeval
timeout
;
struct
timeval
timeout
;
...
...
resend.h
View file @
25ddad56
...
@@ -22,7 +22,7 @@ THE SOFTWARE.
...
@@ -22,7 +22,7 @@ THE SOFTWARE.
#define REQUEST_TIMEOUT 125000
#define REQUEST_TIMEOUT 125000
struct
re
quest
{
struct
re
send
{
unsigned
char
prefix
[
16
];
unsigned
char
prefix
[
16
];
unsigned
char
plen
;
unsigned
char
plen
;
unsigned
short
seqno
;
unsigned
short
seqno
;
...
@@ -30,13 +30,13 @@ struct request {
...
@@ -30,13 +30,13 @@ struct request {
struct
network
*
network
;
struct
network
*
network
;
struct
timeval
time
;
struct
timeval
time
;
int
resend
;
int
resend
;
struct
re
quest
*
next
;
struct
re
send
*
next
;
};
};
extern
struct
timeval
resend_time
;
extern
struct
timeval
resend_time
;
struct
re
quest
*
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
re
send
*
find_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
struct
request
**
previous_return
);
struct
resend
**
previous_return
);
int
record_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
int
record_request
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
unsigned
short
seqno
,
unsigned
short
router_hash
,
struct
network
*
net
,
int
resend
);
struct
network
*
net
,
int
resend
);
...
...
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