-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed scheduling from poll to timed wait and add test coverage. #62
Conversation
Codecov Report
@@ Coverage Diff @@
## master #62 +/- ##
==========================================
- Coverage 74.4% 74.28% -0.12%
==========================================
Files 8 8
Lines 543 560 +17
Branches 86 93 +7
==========================================
+ Hits 404 416 +12
+ Misses 70 68 -2
- Partials 69 76 +7
Continue to review full report at Codecov.
|
src/schedule.c
Outdated
* | ||
* @return the Epoch time of next imminent schedule event | ||
*/ | ||
time_t __get_next_unixtime(schedule_t *s, time_t unixtime, time_t weekly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this an exported function & make the signature the same as get_blocked_at_time()
except for the return value.
src/schedule.c
Outdated
@@ -190,14 +189,14 @@ void destroy_schedule( schedule_t *s ) | |||
|
|||
|
|||
/* See schedule.h for details. */ | |||
char* get_blocked_at_time( schedule_t *s, time_t unixtime ) | |||
char* get_blocked_at_time( schedule_t *s, time_t unixtime, time_t *next_unixtime ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function doesn't help get the next_unixtime, so the functionality should live in the function described below instead. Revert this function.
src/scheduler.c
Outdated
@@ -118,29 +120,35 @@ void *scheduler_thread(void *args) | |||
|
|||
call_firewall( firewall_cmd, NULL ); | |||
|
|||
while (1) { | |||
struct timespec tm; | |||
while( true ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to wait for the clock to start, make it a function so it's clear that's what you're doing. Also ensure that you sleep for some amount of time.
No description provided.