Commit 33dfec50 authored by David Byers's avatar David Byers

New file: src/server/sync.c

Minoor updates to other files
parent e30734dc
Mon Sep 22 19:06:05 1997 David Byers <davby@litefix.ida.liu.se>
* src/server/cache-node.h: New flags: snapshot and synced.
Sun Sep 21 21:16:28 1997 David Byers <davby@litefix.ida.liu.se>
* src/server/memory.c (copy_text_stat): Call copy_aux_item_list.
(copy_aux_item_list): New function.
(copy_aux_item): New function.
(copy_conference): Call copy_aux_item_list.
(clear_conference): Free the aux_item_list
(init_conference): Init the aux_item_list.
(clear_text_stat): Free the aux_item_list.
(init_text_stat): Init the aux_item_list.
(init_aux_item_list): New function.
Sat Sep 13 15:07:32 1997 David Byers <davby@ida.liu.se>
* run-support/aux-items.conf: New file. This is the aux-item
......
\input texinfo @c -*-texinfo-*-
@c $Id: Protocol-A.texi,v 1.5 1997/09/13 15:31:27 byers Exp $
@c $Id: Protocol-A.texi,v 1.6 1997/10/23 12:40:35 byers Exp $
@c %**start of header
@setfilename protocol-a.info
@settitle LysKOM Protocol A
......@@ -1236,7 +1236,7 @@ conference numbers can be specified.
@subsubsection Text Numbers
v
@example
Text-No ::= INT32;
Local-Text-No ::= INT32;
......@@ -3913,9 +3913,9 @@ zero, the server will return an error.
@example
1 34 119 10 5
@t{=1 5 @{ 0 0 466 478 391 @}}
@t{=1 10 5 @{ 0 0 466 478 391 @}}
1 34 119 16 5
@t{=1 3 @{ 481 0 491 @}}
@t{=1 16 3 @{ 481 0 491 @}}
1 34 119 19 5
@t{%2 16 0}
@end example
......@@ -6736,15 +6736,16 @@ text/plain, should support text/enriched and are encouraged to support
HTML.
@menu
* Reformattable Text (x-kom/text) ::
* Reformattable Text (x-kom/basic) ::
* Unreadable reformattable text (x-kom/ö) ::
* The User Area (x-kom/user-area) ::
* Conference Lists (x-kom/conflist) ::
@end menu
@node Reformattable Text (x-kom/text), The User Area (x-kom/user-area),, LysKOM Content Types
@node Reformattable Text (x-kom/basic), The User Area (x-kom/ö),, LysKOM Content Types
@section Reformattable Text
This type of content corresponds to the mime type x-kom/text. It is raw
This type of content corresponds to the mime type x-kom/basic. It is raw
text that can be reformatted by the client without ill effectes, but
that can be legibly displayed on a text terminal without formatting.
......@@ -6765,7 +6766,15 @@ that matched that regexp is to be prefixed to all lines of the
paragraph.
@end itemize
@node The User Area (x-kom/user-area), Conference Lists (x-kom/conflist), Reformattable Text (x-kom/text), LysKOM Content Types
@node Unreadable reformattable text (x-kom/ö), The User Area (x-kom/user-area), Reformattable Text (x-kom/basic), LysKOM Content Types
@section Unreadable reformattable text
In this text format, paragraphs are terminated by a single newline
character. Lines may be of any length. Indentation at the beginning of
the line should be preserved.
@node The User Area (x-kom/user-area), Conference Lists (x-kom/conflist), Reformattable Text (x-kom/ö), LysKOM Content Types
@section The User Area
@node Conference Lists (x-kom/conflist), , The User Area (x-kom/user-area), LysKOM Content Types
......
#
# Generated from: Makefile.src,v 1.10 1996/08/04 02:03:46 ceder Exp
# Generated from: Makefile.src,v 1.11 1997/09/13 15:31:36 byers Exp
# Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......
#
# $Id: aux-items.conf,v 1.1 1997/09/13 15:31:37 byers Exp $
# $Id: aux-items.conf,v 1.2 1997/10/23 12:40:41 byers Exp $
# Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -66,7 +66,7 @@
{
inherit = false;
inherit-limit = 1;
validate = "^[CTP][0-9]+ ";
validate = "^[CTP][0-9]+";
}
......
Bool
sync_part(void)
{
static time_t last_sync_start = NO_TIME;
syncing_or_saving = 1;
if ( last_sync_start == NO_TIME )
{
last_sync_start = time(NULL);
sync_state = sync_idle;
}
switch ( sync_state )
{
case sync_idle:
if (ldifftime(time(NULL), last_sync_start) < 60 * param.sync_interval)
{
syncing_or_saving = 0;
return TRUE;
}
last_sync_start = time(NULL);
sync_start();
break;
case sync_active:
if (next_conf_to_sync < highest_conf_no)
{
sync_one_conf();
}
else if (next_text_to_sync < highest_text_no)
{
sync_one_text();
}
else
{
sync_finish();
}
break;
case sync_wait:
if (ldifftime(time(NULL), last_sync_start)
< 60 * param.sync_retry_interval)
{
syncing_or_saving = 0;
return TRUE;
}
last_sync_start = time(NULL);
sync_start();
break;
case sync_error:
log("sync: error saving new file. Retrying.");
sync_recover();
break;
default:
restart_kom("sync: unknown state %d. I'm stumped.\n", sync_state)
break;
}
if ( file_b != NULL && ferror(file_b) != 0)
{
log("sync: error saving new file. Retrying.");
sync_state = sync_error;
sync_recover();
}
syncing_or_saving = 0;
return FALSE;
}
/*
* sync_recover
*
* This is called when syncing failed in the middle of a file.
*
* All cache nodes that have been written to disk are checked. If
* we saved a dirty copy (saved_dirty is set), and ptr is clear,
* we have to retrieve the saved copy from the failed file and set
* the dirty bit. If ptr is set, we still have to set the dirty bit,
* if saved_dirty is set.
*
* Finally, we set pos and size to saved_pos and saved_size.
*/
void
sync_recover(void)
{
unsigned long i;
long pos, size;
unsigned long recovered;
unsigned short fatal;
Cache_node *node;
/*
* Read back texts from the failed file
*/
log("sync: Recovering texts after save failure.");
for (i = 1; i < next_text_to_save; i++)
{
node = get_text_node(i);
if (node == NULL || !node->s.exists)
continue;
pos = node->pos;
size = node->size;
node->s.dirty = node->s.saved_dirty;
node->s.snapshot = 0;
node->pos = node->saved_pos;
node->size = node->saved_size;
if (node->s.saved_dirty && node->ptr == NULL)
{
node->ptr = read_text_stat(file_b_r, pos, size);
if (node->ptr == NULL)
{
log("sync: failed to recover text %d. "
"Reverting to previously saved version.");
fatal = 1;
}
}
}
/*
* Read back conferences from the failed file
*/
recovered = 0;
log("sync: Recovering conferences after save failure.");
for (i = 1; i < next_conf_to_save; i++)
{
node = get_conf_node(i);
if (node == NULL || node->s.exists)
continue;
pos = node->pos;
size = node->size;
node->s.dirty = node->s.saved_dirty;
node->s.snapshot = 0;
node->pos = node->saved_pos;
node->size = node->saved_size;
if (node->s.saved_dirty && node->ptr == NULL)
{
node->ptr = read_conf_stat(file_b_r, pos, size);
if (node->ptr == NULL)
{
log("sync: failed to recover text %d. "
"Reverting to previously saved version.");
fatal = 1;
}
}
/*
* Read back persons from the file
*/
node = get_pers_node(i);
if (node == NULL || !node->s.exists)
continue;
pos = node->pos;
size = node->size;
node->s.dirty = node->s.saved_dirty;
node->s.snapshot = 0;
node->pos = node->saved_pos;
node->size = node->saved_size;
if (node->s.saved_dirty && node->ptr == NULL)
{
node->ptr = read_pers_stat(file_b_r, pos, size);
if (node->ptr == NULL)
{
log("sync: failed to recover text %d. "
"Reverting to previously saved version.");
fatal = 1;
}
}
}
if (fatal)
{
restart_kom("sync_recover: readback failed. Aborting.");
}
sync_state = sync_wait;
next_text_to_sync = 1;
next_conf_to_sync = 1;
}
void save_one_text(void)
{
Cache_node *node;
node = get_text_node(next_text_to_sync);
while (next_text_to_sync < highest_text_no)
{
node = get_text_node(next_text_to_sync);
if (node == NULL || !node->s.exists)
{
next_text_to_sync += 1;
continue;
}
node->saved_pos = node->pos;
node->saved_size = node->size;
node->s.saved_dirty = node->s.dirty;
if (node->snap_shot)
{
}
else if (node->ptr)
{
}
else
{
}
}
else
{
next_text_to_sync += 1;
}
}
void save_one_conf(void)
{
}
void sync_start(void)
{
}
void sync_finish(void)
{
}
# versions -- This file specifies various version numbers for lyskomd.
# $Id: versions,v 1.11 1996/08/03 01:29:00 ceder Exp $
# $Id: versions,v 1.12 1997/10/23 12:40:34 byers Exp $
# Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -27,7 +27,7 @@
# does currently *not* introduce comments, it only looks that way.
# Version of prot-A.txt that this server implements:
PROTOCOL-A-LEVEL: 9
PROTOCOL-A-LEVEL: 10
# Name of the LysKOM server software:
SERVER-SOFTWARE: lyskomd
......@@ -36,7 +36,7 @@ SERVER-SOFTWARE: lyskomd
# you make an unofficial distribution, *please* change this to
# something unique! Suggestion: suffix it with your initials,
# e.g. 1.7.0.ppp.1
SERVER-VERSION: 1.9.0
SERVER-VERSION: 2.0.0.dcb.1
# Old clients don't know how to get the version number as a string, so
# they are stuck with this old-format integer version number. This
......
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