Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
0eac39a6
Commit
0eac39a6
authored
Dec 17, 2002
by
Mac Newbold
Browse files
Fix small bug that was causing the cache not to use the full size
available to it.
parent
d8252765
Changes
1
Hide whitespace changes
Inline
Side-by-side
pxe/proxydhcp.c
View file @
0eac39a6
...
...
@@ -96,7 +96,6 @@ typedef struct {
int
in_addr
;
int
lastmsg
;
}
ec_elt
;
int
ec_elt_size
=
sizeof
(
ec_elt
);
ec_elt
evcache
[
EVENTCACHESIZE
];
ec_elt
ec_tmp
;
...
...
@@ -125,7 +124,7 @@ int rv;
/* Some support functions for the event cache */
ec_elt
*
ec_next
(
ec_elt
*
ptr
)
{
if
(
ptr
<
ec_front
||
ptr
>
ec_back
)
{
return
0
;
}
ptr
+=
ec_elt_size
;
ptr
+=
1
;
if
(
ptr
==
ec_back
)
{
ptr
=
ec_front
;
}
return
ptr
;
}
...
...
@@ -133,7 +132,7 @@ ec_elt* ec_next(ec_elt* ptr) {
ec_elt
*
ec_prev
(
ec_elt
*
ptr
)
{
if
(
ptr
<
ec_front
||
ptr
>
ec_back
)
{
return
0
;
}
if
(
ptr
==
ec_front
)
{
ptr
=
ec_back
;
}
ptr
-=
ec_elt_size
;
ptr
-=
1
;
return
ptr
;
}
...
...
@@ -370,10 +369,13 @@ main(int argc, char *argv[])
}
#endif
#ifdef EVENTSYS
ec_front
=&
evcache
[
0
];
ec_back
=&
evcache
[
EVENTCACHESIZE
];
ec_head
=
ec_front
;
ec_tail
=
ec_front
;
ec_front
=&
(
evcache
[
0
]);
ec_back
=&
(
evcache
[
EVENTCACHESIZE
]);
ec_head
=
ec_front
;
ec_tail
=
ec_front
;
printf
(
"event_cache_front: %u
\n
event_cache_back: %u
\n
head: %u
\n
head-next: %u
\n
head-prev: %u
\n
"
,
ec_front
,
ec_back
,
ec_head
,
ec_next
(
ec_head
),
ec_prev
(
ec_head
));
#endif
printf
(
"Server started on port %d
\n\n
"
,
ntohs
(
server
.
sin_port
));
...
...
Write
Preview
Supports
Markdown
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