Commit d8105df4 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

All configuration parameters that are time periods can now have an

optional suffix such as "hours" appended.  Store them as a struct
timeval, not as an int, so that the bulk of the code doesn't have to
take the unit into account.  Use "struct timeval" instead of a number
of milliseconds or seconds in several places.  This fixes a number of
potential and actual overflows.  Added utility functions for struct
timeval.
parent 933a98d8
2003-07-12 Per Cederqvist <ceder@ceder.dyndns.org>
All configuration parameters that are time periods can now have an
optional suffix such as "hours" appended. Store them as a struct
timeval, not as an int, so that the bulk of the code doesn't have
to take the unit into account.
* src/server/param.h (struct kom_par): Changed the type of the
following fields from int to struct timeval:
garb_busy_postponement, garbtimeout, synctimeout, garb_interval,
sync_interval, sync_retry_interval.
* src/server/server-config.c: (parameters): Changed the assigner
of "Garb busy postponement", "Garb timeout", "Sync timeout", "Garb
interval", "Sync interval" and "Sync retry interval" from int to
timeval, and added appropriate default suffixes to those
configuration parameters.
* src/server/conf-file.h (struct parameter): New field:
default_suffix.
(assign_timeval): New assigner.
* src/server/conf-file.c (struct suffix_conversion): New struct.
(suffix_table): New table.
(assign_timeval): New assigner.
Use "struct timeval" instead of a number of milliseconds or
seconds in several places. This fixes a number of potential and
actual overflows.
* src/server/connections.h (Connection): Change the type of the
session_start and active_time fields from time_t to struct
timeval.
* src/server/server-time.h (current_time): Now a struct timeval,
not a time_t.
* src/server/disk-end-of-atomic.c, src/server/end-of-atomic.h
(end_of_atomic): Now returns a struct timeval, not a long.
* src/server/cache.h (sync_part): Now returns a struct timeval.
* src/server/text.c (add_text_in_conf): Extract the
seconds from the current_time.
(create_text_add_miscs): Ditto.
(do_create_text): Ditto.
(add_recipient): Ditto.
(add_comment): Ditto.
(add_footnote): Ditto.
* src/server/text-garb.c (garb_text): Extract the seconds from the
current_time.
* src/server/simple-cache.c (sync_output_header): Extract the
seconds from the current_time.
(sync_part): Return a struct timeval instead of a long. Use
struct timeval instead of a time_t. Use timeval_remaining() to
simplify the code.
(init_cache): Use a struct timeval instead of time_t.
(cache_sync_all): Adjusted to new API of sync_part().
* src/server/session.c (leave_conf): Extract the seconds from the
current_time.
(login_old): Ditto.
(login): Ditto.
(get_static_session_info): Ditto.
(get_time): Ditto.
(logout): Ditto. Use timeval_diff_sec instead of ldifftime.
(who_is_on_dynamic): Use timeval_diff_sec instead of ldifftime.
(get_session_info): Ditto.
(get_session_info_ident): Ditto.
* src/server/send-async.c (async_rejected_connection): Use struct
timeval instead of time_t.
* src/server/ramkomd.c (current_time): Now a struct timeval, not
a time_t.
(main): Adjusted for the new type of current_time.
* src/server/person.c (create_person_generic): Extract the seconds
from the current_time.
* src/server/membership.c (do_add_rec_time): Extract the seconds
from the current_time.
(do_add_member): Ditto.
* src/server/internal-connections.c (init_connection): Use struct
timeval instead of time_t.
* src/server/connections.c (set_time): Use struct timeval instead
of time_t.
(dump_statistics): Ditto.
(saver_callback): Ditto.
(setup_timer): Replaced the milliseconds argument with a struct
timeval argument.
(garb_callback): Simplified the code.
* src/server/conference.c (do_create_conf): Extract the seconds
from the current_time.
* src/server/aux-items.c (prepare_aux_item): Extract the seconds
from the current_time.
Added utility functions for struct timeval.
* src/libraries/libmisc/Makefile.am (libmisc_a_SOURCES): Added
timeval-util.h and timeval-util.c.
* src/libraries/libmisc/timeval-util.h,
* src/libraries/libmisc/timeval-util.c: New files.
(timeval_subtract): New static function.
(timeval_nonzero): New function.
(timeval_zero): Ditto.
(timeval_ctor): Ditto.
(timeval_remaining): Ditto.
(timeval_greater): Ditto.
(timeval_less): Ditto.
(timeval_diff_sec): Ditto.
Don't store garbage in struct timevals passed to liboop.
* src/server/connections.c (setup_timer): Fixed an error that
caused the tv_usec field to be out-of-range.
......
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