Skip to content
Snippets Groups Projects
Commit 36709438 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

bugs fixed

Rev: src/backend.c:1.6
Rev: src/modules/call_out/call_out.c:1.2
parent a2c02093
No related branches found
No related tags found
No related merge requests found
...@@ -191,10 +191,14 @@ void backend() ...@@ -191,10 +191,14 @@ void backend()
while(first_object) while(first_object)
{ {
next_timeout.tv_usec = 0; next_timeout.tv_usec = 0;
#if 0
next_timeout.tv_sec = 7 * 24 * 60 * 60; /* See you in a week */ next_timeout.tv_sec = 7 * 24 * 60 * 60; /* See you in a week */
#else
next_timeout.tv_sec = 15; /* See you in a week */
#endif
my_add_timeval(&next_timeout, &current_time); my_add_timeval(&next_timeout, &current_time);
call_callback(& backend_callbacks); call_callback(& backend_callbacks, (void *)0);
sets=selectors; sets=selectors;
alloca(0); /* Do garbage collect */ alloca(0); /* Do garbage collect */
...@@ -204,6 +208,13 @@ void backend() ...@@ -204,6 +208,13 @@ void backend()
GETTIMEOFDAY(&current_time); GETTIMEOFDAY(&current_time);
my_subtract_timeval(&next_timeout, &current_time); my_subtract_timeval(&next_timeout, &current_time);
if(next_timeout.tv_sec < 0)
{
next_timeout.tv_usec = 0;
next_timeout.tv_sec = 0;
}
i=select(max_fd+1, &sets.read, &sets.write, 0, &next_timeout); i=select(max_fd+1, &sets.read, &sets.write, 0, &next_timeout);
GETTIMEOFDAY(&current_time); GETTIMEOFDAY(&current_time);
...@@ -236,6 +247,7 @@ void backend() ...@@ -236,6 +247,7 @@ void backend()
} }
} }
call_callback(& backend_callbacks, (void *)1);
} }
UNSETJMP(back); UNSETJMP(back);
......
...@@ -181,13 +181,15 @@ void f_call_out(INT32 args) ...@@ -181,13 +181,15 @@ void f_call_out(INT32 args)
new_call_out(args,sp-args); new_call_out(args,sp-args);
} }
void do_call_outs(struct callback *ignored, void *ignored_too) void do_call_outs(struct callback *ignored, void *ignored_too, void *arg)
{ {
call_out *c; call_out *c;
int args; int args;
time_t tmp; time_t tmp;
verify_call_outs(); verify_call_outs();
if(arg)
{
tmp=(time_t)TIME(0); tmp=(time_t)TIME(0);
while(num_pending_calls && while(num_pending_calls &&
my_timercmp(&pending_calls[0]->tv,<=,&current_time)) my_timercmp(&pending_calls[0]->tv,<=,&current_time))
...@@ -214,11 +216,18 @@ void do_call_outs(struct callback *ignored, void *ignored_too) ...@@ -214,11 +216,18 @@ void do_call_outs(struct callback *ignored, void *ignored_too)
if(tmp != (time_t) TIME(0)) break; if(tmp != (time_t) TIME(0)) break;
} }
}
else /* if(arg) */
{
if(num_pending_calls) if(num_pending_calls)
{
if(my_timercmp(& pending_calls[0]->tv, < , &next_timeout)) if(my_timercmp(& pending_calls[0]->tv, < , &next_timeout))
{
next_timeout = pending_calls[0]->tv; next_timeout = pending_calls[0]->tv;
} }
}
}
}
static int find_call_out(struct svalue *fun) static int find_call_out(struct svalue *fun)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment