Skip to content
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

Merged
merged 3 commits into from
Nov 3, 2017
Merged

Changed scheduling from poll to timed wait and add test coverage. #62

merged 3 commits into from
Nov 3, 2017

Conversation

cableramki
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Nov 3, 2017

Codecov Report

Merging #62 into master will decrease coverage by 0.11%.
The diff coverage is 61.11%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/schedule.c 75% <61.11%> (-0.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dab8989...0a981c5. Read the comment docs.

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)
Copy link
Member

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 )
Copy link
Member

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 ) {
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants