Commit 63e5cf98 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(set_time): No longer static.

(setup_timer): Ditto.
(garb_callback): Moved to text-garb.c.
(saver_callback): The source argument is actually used.
(toploop): Moved the garb timer to text-garb.c.
(server_idle): New function.
parent de5bfc46
/*
* $Id: connections.c,v 0.97 2003/07/12 22:26:32 ceder Exp $
* $Id: connections.c,v 0.98 2003/07/13 11:07:24 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -167,7 +167,7 @@ queue_remove(Connection *c)
c->queue_next = NULL;
}
static void
void
set_time(void)
{
struct timeval last_time;
......@@ -848,7 +848,7 @@ read_from_connection(Connection *conn)
}
static void
void
setup_timer(struct timeval *tv,
struct timeval interval)
{
......@@ -928,29 +928,7 @@ check_idle_callback(oop_source *UNUSED(source),
}
static void *
garb_callback(oop_source *UNUSED(source),
struct timeval UNUSED(tv),
void *user)
{
struct timeval *next_timer = user;
if (is_idle)
{
set_time();
if (garb_text() == FALSE)
setup_timer(next_timer, param.garbtimeout);
else
setup_timer(next_timer, param.garb_interval);
}
else
setup_timer(next_timer, param.garb_busy_postponement);
source->on_time(source, *next_timer, garb_callback, user);
return OOP_CONTINUE;
}
static void *
saver_callback(oop_source *UNUSED(source),
saver_callback(oop_source *source,
struct timeval UNUSED(tv),
void *user)
{
......@@ -1020,15 +998,13 @@ handle_accept_event(struct isc_mcb *mcb,
void
toploop(void)
{
struct timeval garb_timer;
struct timeval saver_timer;
void *exit_reason;
oop_source *source = oop_sys_source(kom_server_oop_src);
/* Start the garb right away. */
garb_timer = OOP_TIME_NOW;
source->on_time(source, garb_timer, garb_callback, &garb_timer);
start_garb_thread(source);
/* Hack to find out when we are idle. */
source->on_time(source, OOP_TIME_NOW, check_idle_callback, NULL);
......@@ -1057,6 +1033,12 @@ toploop(void)
if (is_idle == FALSE)
source->cancel_time(source, OOP_TIME_NOW, check_idle_callback, NULL);
stop_garb_thread(source);
source->cancel_time(source, saver_timer, saver_callback, &saver_timer);
source->cancel_time(source, garb_timer, garb_callback, &garb_timer);
}
Bool
server_idle(void)
{
return is_idle;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment