various fixes related to event scheduler.

server main loop is now just fd_poll()
This commit is contained in:
gardners 2012-06-22 14:11:14 +09:30
parent f0ed4b2e52
commit 91bccec71d
4 changed files with 14 additions and 19 deletions

View File

@ -169,17 +169,15 @@ int overlayServerMode()
based on load/route table size etc) */
fd_setalarm(overlay_route_tick,1000,1000);
while(1) {
/* Start scheduling interface ticks */
fd_setalarm(overlay_check_ticks,1,500);
/* Keep an eye on VoMP calls so that we can expire stale ones etc */
fd_setalarm(vomp_tick,1000,1000);
while(1) {
/* Check for activitiy and respond to it */
fd_poll();
/* Work out how long we can wait before we need to tick */
memabuseCheck();
vomp_tick();
overlay_check_ticks();
}
return 0;

View File

@ -975,16 +975,10 @@ TIMING_CHECK();
int
overlay_check_ticks(void) {
void overlay_check_ticks(void) {
/* Check if any interface(s) are due for a tick */
int i;
TIMING_CHECK();
/* Check for changes to interfaces */
overlay_interface_discover();
TIMING_CHECK();
long long now = overlay_gettime_ms();
/* Now check if the next tick time for the interfaces is no later than that time.
@ -1011,6 +1005,9 @@ overlay_check_ticks(void) {
TIMING_CHECK();
}
/* Update interval until next tick */
fd_setalarm(overlay_check_ticks,overlay_time_until_next_tick(),500);
return 0;
}

View File

@ -827,7 +827,7 @@ int overlay_interface_init_socket(int i,struct sockaddr_in src_addr,struct socka
void overlay_interface_discover();
long long overlay_time_until_next_tick();
int overlay_rx_messages();
int overlay_check_ticks();
void overlay_check_ticks();
int overlay_add_selfannouncement();
int overlay_frame_package_fmt1(overlay_frame *p,overlay_buffer *b);
int overlay_interface_args(const char *arg);
@ -1427,7 +1427,7 @@ int vomp_mdp_event(overlay_mdp_frame *mdp,
int vomp_mdp_received(overlay_mdp_frame *mdp);
char *vomp_describe_state(int state);
char *vomp_describe_codec(int c);
int vomp_tick();
void vomp_tick();
int vomp_tick_interval();
int vomp_sample_size(int c);
int vomp_codec_timespan(int c);

2
vomp.c
View File

@ -1457,7 +1457,7 @@ int app_vomp_monitor(int argc, const char *const *argv, struct command_line_opti
return overlay_mdp_client_done();
}
int vomp_tick()
void vomp_tick()
{
/* Send any reminder packets for call state, and also process any audio. */
unsigned long long now=overlay_gettime_ms();