1. 06 Nov, 2006 1 commit
    • Per Cederqvist's avatar
      Introduce datafile format version 3. A textstat contains · c1ef8d5b
      Per Cederqvist authored
      "generation" and "reclamation" fields.
      * src/include/kom-types.h (Text_stat): Added fields generation
      and reclamation.
      * src/server/simple-cache.c (cached_get_text): Handle text file
      generation 0 in the old-fashioned way.  Added a #warning about
      other generations.  Check return value of fseek.
      (cached_create_text): Added a #warning about nonzero generations
      of the text file.
      (cached_create_text): Initialize generation and reclamation.
      (save_one_conf): Do a file copy only if the formats of file A and
      B are the same.  Otherwise, parse the object into a temporary
      object and re-serialize it.
      (save_one_pers): Ditto.
      (save_one_text): Ditto.
      (init_cache): Handle data file format 3.
      * src/server/ram-parse.c (fparse_text_stat_3): New static function.
      (fparse_text_stat_2): Set generation and reclamation to 0.
      (fparse_text_stat_0): Ditto.
      (fparse_info): Handle data file format 3.
      (fparse_conference): Ditto.
      (fparse_person): Ditto.
      (fparse_membership): Ditto.
      (fparse_membership_list): Ditto.
      (fparse_text_stat): Ditto.
      (fparse_member): Ditto.
      * src/server/ram-output.c (foutput_info): Handle data file format 3.
      (foutput_text_stat_3): New static function.
      (foutput_person): Ditto.
      (foutput_conference): Ditto.
      (foutput_text_stat): Ditto.
      (foutput_membership): Ditto.
      (foutput_membership_list): Ditto.
      (foutput_member): Ditto.
      (foutput_conf_type): Ditto.
      * src/server/ram-io.c (output_format): Initialize it to 3.
      (dbfile_open_read): Handle data file format 3.
      * src/server/memory.c (copy_text_stat): Handle generation and
      reclamation.
      (init_text_stat): Initialize generation and reclamation.
      * src/server/membership.c (read_ranges_postcondition): Use data
      file format 3 when dumping a membership to stderr.
      * src/server/dbck.c (main): Handle data file format 3.
      * src/server/dbck-cache.c (cached_get_text): Handle text file
      generation 0 in the old-fashioned way.  Added a #warning about
      other generations.
      (cached_flush_text): Flush a generation 0 text file.  Added a
      #warning about other generations.
      (sync_output_header): Handle data file format 3.
      (cache_sync_all): Ditto.
      (init_cache): Ditto.
      * src/server/testsuite/test-l2g.c (main): Use data
      file format 3 when reading an Local2Global structure from stdin,
      or writing it to stdout.
      c1ef8d5b
  2. 20 Oct, 2006 1 commit
    • Per Cederqvist's avatar
      Wrap all file pointers that refer to the database files inside a · 554e4c59
      Per Cederqvist authored
      "struct dbfile".  Add a database version field to that struct, and
      remove the global database format variables.  This allows lyskomd
      to have files in different versions open at the same time, so that
      it can convert format X to format X+1 on the fly.  (This is more
      preparation for bug 1616.)
      * src/server/ram-io.h (struct dbfile): New struct.
      (dbfile_delete): New function.
      (set_output_format): New function.
      (dbfile_open_write): New function.
      (dbfile_open_read): New function.
      (dump_dbfile_stats): New function.
      (dbfile_ftell): The argument is now a struct dbfile*, not FILE*.
      (dbfile_getc): Ditto.
      (dbfile_ungetc): Ditto.
      * src/server/ram-io.c (output_format): Moved from ram-output.c and
      made static variable.  This defines the output format of all
      struct dbfile objects created after a change to the variable.
      (nr_dbfile_objects): New static statistics variable.
      (nr_dbfile_files): New static statistics variable.
      (dbfile_new): New static function.
      (dbfile_delete): New function.
      (set_output_format): Moved from ram-output.c.
      (get_version): Moved from simple-cache.c.  Changed return type to
      int.  The argument is an open dbfile, not a file name.  Use
      dbfile_getc() instead of getc().
      (dbfile_open_read): New function.
      (dbfile_open_write): New function.
      (dump_dbfile_stats): New function.
      (dbfile_ftell): The argument is now a struct dbfile*, not FILE*.
      (dbfile_getc): Ditto.
      (dbfile_ungetc): Ditto.
      * src/server/conference.c: Include ram-io.h, since
      local-to-global.h needs it.
      * src/server/memory.c: Ditto.
      * src/server/person.c: Ditto.
      * src/server/prot-a-output.c: Ditto.
      * src/server/text.c: Ditto.
      * src/server/membership.c: Include ram-io.h.
      (read_ranges_postcondition): Set up a dbfile wrapper around stderr
      for the report created if check_membership() fails.
      * src/server/local-to-global.h, src/server/local-to-global.c
      (l2g_read): The fp argument is now a struct dbfile*, not a FILE*.
      * src/server/dbck.c (oformat): Removed.  The format is stored
      inside the dbfile struct instead.
      (main): Report an error message if an attempt to use an undefined
      output format is detected.
      * src/server/dbck-cache.c: Change all FILE* that refer to the
      status files to struct dbfile* in all functions, and made
      appropriate changes.  Use fp->format instead of the global
      variable oformat or data_file_version.
      (get_version): Moved to ram-io.c.
      (sync_output_header): Removed the oformat argument.  Use
      fp->format instead.  All callers updated.
      (cache_sync_all): Use dbfile_open_write() instead of i_fopen(),
      and dbfile_delete() instead of i_fclose().
      (init_cache): Removed the data_file_version variable, as the
      format is now stored inside the dbfile struct.  Use
      dbfile_open_read() instead of i_fopen(), and dbfile_delete()
      instead of i_fclose().
      * doc/lyskomd.texi (Modifying Stored Types): The default database
      format is now defined in ram-io.c, and nowhere else.  It is
      preferrable if lyskomd is able to convert an old format to a new
      one after an upgrade.
      * src/server/testsuite/test-l2g.c (main): Added a dbfile wrapper
      around stdin in call to l2g_read(), and another around stderr in
      call to l2g_write().
      * src/server/testsuite/Makefile.am (test_l2g_LDADD): Include
      libeintr.a.
      * src/server/simple-cache.c: Change all FILE* that refer to the
      status files to struct dbfile* in all functions, and made
      appropriate changes.
      (pre_sync): Use dbfile_delete() instead of i_fclose(), and
      dbfile_open_write() instead of i_fopen().
      (post_sync): Use dbfile_delete() instead of i_fclose(), and
      dbfile_open_read() instead of i_fopen().
      (save_one_text): Use dbfile_delete() instead of i_fclose(), and
      dbfile_open_read() instead of i_fopen().
      (sync_part): Use dbfile_delete() instead of i_fclose().
      (init_cache): Removed local variable datafile_version; use
      fp->format instead.  Use dbfile_open_read() instead of i_fopen().
      Removed call to set_input_format(), as dbfile_open_read() does
      the same thing.
      (free_all_cache): Use dbfile_delete() instead of i_fclose().
      * src/server/ramkomd.c (dump_exit_statistics): Dump dbfile stats.
      * src/server/ram-parse.h, src/server/ram-parse.c: Change all
      FILE* that refer to the status files to struct dbfile* in all
      functions, and made appropriate changes.
      (set_input_format): Removed.
      * src/server/ram-parse.c (input_format): Removed.  All users
      changed to use fp->format instead, so that lyskomd can read files
      with different versions at the same time.
      (fparse_text_stat_2): Code cleanup.
      (fparse_text_stat_0): Use dbfile_ungetc() instead of ungetc().
      * src/server/ram-output.h, src/server/ram-output.c: Change all
      FILE* that refer to the status files to struct dbfile* in all
      functions, and made appropriate changes.
      (output_format): Moved to ram-io.c and made static.
      (set_output_format): Moved to ram-io.c.
      554e4c59
  3. 19 Oct, 2006 2 commits
    • Per Cederqvist's avatar
      Fixed more missed opportunities to use fparse_set_pos() and · 0a162ece
      Per Cederqvist authored
      foutput_newline().
      * src/server/dbck-cache.c (get_version): Use fparse_set_pos()
      intead of fseek() where appropriate.
      (init_cache): Ditto.
      * src/server/simple-cache.c (get_version): Ditto.
      (pre_sync): Removed dead code.  Use foutput_newline() and
      fparse_set_pos() where appropriate.
      (save_one_conf): Use foutput_newline() where appropriate.
      (save_one_pers): Ditto.
      (save_one_text): Ditto.
      (init_cache): Use fparse_set_pos() where appropriate.
      0a162ece
    • Per Cederqvist's avatar
      Improve logging and error messages. · 1b06e63f
      Per Cederqvist authored
      * src/server/simple-cache.c (read_person): Use restart_kom instead
      of kom_log when there is a size mismatch.
      (read_conference): Ditto.
      (pre_sync): Log the file name and error message when the file to
      save in cannot be opened.
      (init_cache): Improve the error message when the database is in
      the wrong format.
      1b06e63f
  4. 18 Oct, 2006 1 commit
    • Per Cederqvist's avatar
      Renamed sync_output_header to foutput_header, and clean up the · ba79469c
      Per Cederqvist authored
      time handling.  This is more preparation for bug 1616.
      * src/server/simple-cache.c (sync_output_header): Renamed to
      foutput_header and moved to ram-output.c.  All callers updated.
      * src/server/ramkomd.c (current_time): Moved to server-time.c.
      (main): Use set_initial_time instead of calling gettimeofday and
      accessing current_time directly.
      * src/server/ram-output.c, src/server/ram-output.h
      (foutput_header): Renamed from sync_output_header.  Use
      output_format instead of a hardcoding it to 2.
      * src/server/dbck.c (main): Call set_initial_time().
      * src/server/dbck-cache.c (sync_output_header): Use foutput_header
      to output a format 2 header.
      * src/server/server-time.c: New file.
      (current_time): Moved here from ramkomd.c.
      * src/server/server-time.c, src/server/server-time.h
      (set_time): Moved here from connections.c.
      (set_initial_time): New function.
      * src/server/connections.c (set_ time): Moved to server-time.c.
      * src/server/Makefile.am (GENOBJS): Added server-time.c.
      (DBCK): Ditto.
      ba79469c
  5. 17 Oct, 2006 1 commit
    • Per Cederqvist's avatar
      Added functions wrapper functions around a few stdio functions, · d7498aeb
      Per Cederqvist authored
      and use them when accessing database files.  This is a preparatory
      step for introducing "struct dbfile", which will enable lyskomd to
      manipulate more than one database file format at the same time.
      That ability is needed for solving bug 1616.
      * src/server/ram-io.c, src/server/ram-io.h: New files.
      (dbfile_ftell): New function.
      (dbfile_getc): New function.
      (dbfile_ungetc): New function.
      * src/server/Makefile.am (libcheck_a_SOURCES): Added ram-io.c.
      (lyskomd_SOURCES): Added ram-io.h and ram-io.c.
      (DBCK): Added ram-io.h and ram-io.c.
      * src/server/simple-cache.c (read_person): Check the return value
      from fparse_set_pos().
      (read_conference): Ditto.
      (read_text_stat): Ditto.
      (write_conf): New static function.
      (save_one_conf): Use it to simplify code.
      (write_text): New static function.
      (save_one_text): Use it to simplify code.
      * src/server/ram-parse.h, src/server/ram-parse.c
      (fparse_set_pos): New function.
      * src/server/ram-output.c: Include ram-io.h.
      (foutput_space): New static function.  Use it where appropriate.
      (foutput_bool): Ditto.
      (foutput_array_start): Ditto.
      (foutput_array_end): Ditto.
      (foutput_array_nodata): Ditto.
      * src/server/ram-output.h, src/server/ram-output.c
      (foutput_atsign): New function.
      (foutput_newline): New function.
      * src/server/dbck-cache.c: Include ram-io.h.  Use dbfile_getc()
      instead of getc(), dbfile_ungetc() instead of ungetc(), and
      dbfile_ftell() instead of ftell(), when accessing the database
      file.  Use foutput_atsign and foutput_newline when appropriate.
      * src/server/local-to-global.c: Ditto.
      * src/server/ram-parse.c: Ditto.
      * src/server/simple-cache.c: Ditto.
      d7498aeb
  6. 01 Oct, 2006 1 commit
  7. 29 Sep, 2006 1 commit
  8. 24 Apr, 2006 1 commit
    • Per Cederqvist's avatar
      Tell svn to ignore core files. · e37c8984
      Per Cederqvist authored
      * src/server/testsuite: Ignore core and vgcore.*.
      
      Replaced the "Client host" and "Client port" configuration file
      parameters with "Listen", and allow lyskomd to listen to more than
      one port.
      * doc/lyskomd.texi (Parameters): Replaced "Client host" and
      "Client port" with "Listen".
      * src/server/ramkomd.c (start_listen_sockets): New static
      function.  Listen to all the ports specified by the "Listen:"
      parameter.
      (server_init): Use start_listen_sockets() instead of calling
      isc_listentcp().  Removed the host and client_port arguments.  All
      callers updated.
      * src/server/testsuite/lyskomd.0/54.exp: New test suite.
      * src/server/conf-file.c (ctor_ipport_list): New static function.
      (dtor_ipport_list): New static function.
      (assign_ipport_list): New static function.
      (cf_ipport_list): New constant.
      * src/server/conf-file.h (struct ipport_entry): New struct.
      (struct ipport_list): New struct.
      (cf_ipport_list): New constant.
      * src/server/param.h (struct kom_par): Replaced "ip_client_host"
      and "ip_client_port" with "listen".
      * src/server/server-config.c (parameters): Ditto.
      * src/server/prot-a-parse-arg-c.awk: Include "conf-file.h" from
      the generated files.
      * src/server/admin.c: Include "conf-file.h".
      * src/server/aux-items.c: Ditto.
      * src/server/checkkomspace.c: Ditto.
      * src/server/conference.c: Ditto.
      * src/server/connections.c: Ditto.
      * src/server/dbck-cache.c: Ditto.
      * src/server/dbck.c: Ditto.
      * src/server/disk-end-of-atomic.c: Ditto.
      * src/server/komrunning.c: Ditto.
      * src/server/lockdb.c: Ditto.
      * src/server/membership.c: Ditto.
      * src/server/person.c: Ditto.
      * src/server/prot-a-output.c: Ditto.
      * src/server/prot-a-parse.c: Ditto.
      * src/server/prot-a.c: Ditto.
      * src/server/regex-match.c: Ditto.
      * src/server/rfc931.c: Ditto.
      * src/server/send-async.c: Ditto.
      * src/server/session.c: Ditto.
      * src/server/simple-cache.c: Ditto.
      * src/server/splitkomdb.c: Ditto.
      * src/server/text-garb.c: Ditto.
      * src/server/text.c: Ditto.
      * src/server/updateLysKOM.c: Ditto.
      * run-support/config: Removed the "Client port" setting.
      
      Adjust the test suite for the above change.
      * src/server/testsuite/lyskomd.0/bug-64.exp: Expect memory leaks
      due to bug 1599.
      * src/server/testsuite/lyskomd.0/53.exp: Expect a more informative
      error message when isc_listentcp fails.
      * src/server/testsuite/lyskomd.0/11.exp: Expect an IP address in
      the "Listening for clients" log message.
      * src/server/testsuite/config/unix.exp (clientport_2): New
      constant.
      (clientport_3): New constant.
      (lyskomd_start): New argument: listen_messages.  Use "Listen:"
      instead of "Client port:".
      (lyskomd_fail_start): Use "Listen:" instead of "Client port:".
      (client_start): New optional argument: port.
      e37c8984
  9. 03 Jan, 2006 1 commit
    • Per Cederqvist's avatar
      Fixed various harmless memory and file descriptor leaks found by · afb8f103
      Per Cederqvist authored
      valgrind.
      * src/server/testsuite/lyskomd.supp: Added aid_lexer_2.
      * src/server/testsuite/lyskomd.0/regexp-match-cov.exp (shutdown):
      Don't expect any suppressed leaked blocks.
      * src/server/testsuite/lyskomd.0/aux-items-cov.exp: Expect less
      suppressed leaked blocks.
      * src/server/testsuite/lyskomd.0/37.exp: Adjusted to new report
      format when configuration errors are found.
      * src/server/testsuite/lyskomd.0/conf-file-cov.exp: Ditto.
      * src/server/simple-cache.c (free_all_cache): Close text_file and
      file_a.
      * src/server/testsuite/lyskomd.supp: Removed i_fopen-2.3.1 and
      i_fopen-2.3.5, which were actually caused by the above problem.
      * src/server/server-config.c (read_configuration): Check the
      return value of read_config().  Free the configuration before
      calling restart_kom if there are any problems with the
      configuration.  Report the name of the configuation file if
      problems are found.
      * src/server/ramkomd.c (dump_exit_statistics): Call clear_info()
      instead of free_kom_info.
      (free_kom_info): Removed.  The new clear_info() function contains
      a better implementation, with less code duplication.
      * src/server/memory.c, src/server/kom-memory.h (clear_info): New
      function.
      * src/server/dbck.c (free_person_scratchpad): New static function.
      (free_person_scratch): Ditto.
      (main): Call free_person_scratch(), clear_info(),
      free_configuration() and free_all_dbck_cache() when terminating to
      make it possible to check for leaks with valgrind.
      * src/server/dbck-cache.c, src/server/dbck-cache.h
      (free_all_dbck_cache): New function.
      * src/server/conf-file.c, src/server/conf-file.h (read_config):
      Changed return type from void to Success.  Return FAILURE instead
      of calling restart_kom when configuration errors are found.
      afb8f103
  10. 28 Dec, 2005 1 commit
    • Per Cederqvist's avatar
      Cleanup of simple-cache.c. (Bug 172). Allocate less memory when · dc65390c
      Per Cederqvist authored
      performing a pattern name match.  
      * src/server/simple-cache.c: Removed obsolete comments.  Fixed
      spelling errors in comments.
      (find_matching_info_compare): Don't overflow if a Conf_no doesn't
      fit in an int.
      (find_matching_info): Removed obsolete comments (bug 172).
      (rebuild_matching_info_entry): Added a comment that explains a
      magic "2" in the code.
      (build_matching_info): Use cached_no_of_existing_conferences()
      instead of next_free_num when deciding how large temporary table
      we need.  Reduce the number of loop induction variables.
      (cached_lookup_name): Made code more readable by introducing a
      temporary variable.
      dc65390c
  11. 27 Dec, 2005 2 commits
    • Per Cederqvist's avatar
      Don't overestimate the number of conferences as next_free_num when · ed41d632
      Per Cederqvist authored
      allocating certain data structures.  (Bug 164).
      * src/server/simple-cache.c (existing_confs): New static
      variable.
      (cached_no_of_existing_conferences): Return existing_confs,
      instead of overestimating the number of conferences as
      next_free_num.  (Bug 164).
      (cached_create_conf): Increase existing_confs.
      (cached_delete_conf): Decrease existing_confs.
      (init_cache): Increase existing_confs when a new conference is
      created.
      (free_all_cache): Decrease existing_confs when conferences are
      deallocated.
      (dump_cache_mem_usage): Dump existing_confs.
      * src/server/testsuite/config/unix.exp (check_memory_usage): Check
      the dump of existing_confs.  Fail if allocated_strings or
      allocated_blocks isn't found in the file.
      ed41d632
    • Per Cederqvist's avatar
      Simplified the name parsing routing, and save some small amount of · 55499424
      Per Cederqvist authored
      memory, by removing the priority field of Matching_info.
      * src/libraries/libcommon/parser.c (parse): Don't let the priority
      influence the match.  The priority functionality was poorly
      documented, not used by lyskomd, and made the code more complex.
      * src/libraries/libcommon/parser.h (Matching_info): Removed the
      priority field, which is no longer used.
      * src/server/simple-cache.c (rebuild_matching_info_entry): Don't
      initialize the priority field.
      (build_matching_info): Ditto.
      55499424
  12. 18 Dec, 2005 2 commits
  13. 21 Jul, 2004 1 commit
  14. 04 Oct, 2003 1 commit
  15. 23 Aug, 2003 1 commit
  16. 16 Aug, 2003 1 commit
  17. 12 Aug, 2003 2 commits
  18. 11 Aug, 2003 2 commits
  19. 27 Jul, 2003 1 commit
  20. 13 Jul, 2003 1 commit
  21. 12 Jul, 2003 4 commits
  22. 10 Jan, 2003 1 commit
    • Per Cederqvist's avatar
      All these changes are only in effect if DEBUG_CALLS is defined: · e6ce93ef
      Per Cederqvist authored
      Include services.h and manipulate.h.
      (block_after_pre_sync): New static variable.
      (save_one_conf): Return immediately if block_after_pre_sync is true.
      (cache_sync_all): Crash if block_after_pre_sync is true.
      (cache_sync_start): New request.
      (cache_sync_finish): New request.
      e6ce93ef
  23. 04 Nov, 2002 1 commit
    • Per Cederqvist's avatar
      (highest_conf_no): Explicitly initialize to 0. · 5c3e55d9
      Per Cederqvist authored
      (highest_text_no): Ditto.
      (write_number_file): New static function.
      (read_number_file): Ditto.
      (cached_create_conf): Call write_number_file, and return
      	KOM_TEMPFAIL if it fails.
      (cached_create_text): Ditto.
      (init_cache): Don't set highest_conf_no and highest_text_no.  They
      	are only used during the save phase.  Call read_number_file.
      5c3e55d9
  24. 31 Oct, 2002 1 commit
  25. 04 Oct, 2002 1 commit
  26. 06 Sep, 2002 1 commit
  27. 29 Mar, 2002 2 commits
  28. 28 Dec, 2001 1 commit
  29. 04 Nov, 2001 1 commit
  30. 03 Nov, 2001 1 commit
  31. 06 Sep, 2000 1 commit