Menu

#159 Server list cache for client

closed-accepted
None
5
2003-06-02
2003-04-16
No

This feature preserves a list of all servers that were found during
lookups with the "Find" item on the menu for at least 30 days.

Under options there is an item called Server cache which allows
you select a number of hours, minutes or days or "off" If you
choose to turn it on, the cache that is younger than the time period
selected is dumped into the list the user sees when they
select "find" Items that are updated by finding them in the server
list are updated. Items that are not found in the server list are
visibly marked as "cached" and have an age specified on them.
Items that are beyond 20 minutes old are darkened and have ?-s
in place of player counts. With this part of the feature
implemented the intial list appears faster, but there is a more
obvious lag that happens at least on dialup when the list is
actually read off of the list server. *But* you can look back up to
30 days and see which servers are apparently off line.

File wise, the cache is a binary file that is stored under the
bzcache directory. Items over 30 days old are flushed *if* we
were able to updated at least that many items when we
connected to the list server. Hence 20 old items can be flushed if
we found and updated at least 20 items. This prevents a user
who rarely plays from zeroing out their cache. Also the settings in
the options menu do not affect what is saved in the cache, it just
effects what the user sees displayed under the "find" menu.

The most useful feature is that when errors happen with the list
server, the entire cache (30 days of it) is dumped into the current
listing. Hence even if your list server fails, you still have at least
*30 days* worth of servers to choose from. In this case the
options setting makes no difference, all items are shown. The
default setting in the options menu is "off" and this feature still
works in this case.

programming wise, this was done under windows w/ vc++ and
you *might* have to change things to get them to compile under
other platforms. I also moved a fair amount of items into menus.h
from menus.cxx, I believe I need at least the ServerMenu
declaration in menus.h, while perhaps the other things I moved
into the header file aren't needed there.

Discussion

  • Michael Hoffman

    Michael Hoffman - 2003-04-16

    vs 04 16 03 source

     
  • Michael Hoffman

    Michael Hoffman - 2003-04-16

    Logged In: YES
    user_id=619820

    A simple way of demonstrating this is to open up the client, do a find,
    close the client down. Now rename the list server name in bzflag.bzc or
    whatever it is to nonsense. Now restart the client. You should see the
    same list, more or less even when the client fails to find the list server.

    The file name of the cache also uses the first 7 chars of Version to form
    the filename hence BZFS107Servers.bzs is the file for this version in the
    cache directory. As newer versions are created, the cache will be
    separate for them.

     
  • Michael Hoffman

    Michael Hoffman - 2003-04-19

    improved performance of "find" menu

     
  • Michael Hoffman

    Michael Hoffman - 2003-04-19

    Logged In: YES
    user_id=619820

    I just vastly improved the performance of adding entries under the find
    menu. It had been sorting via a horrible sorting algorithm *each* and
    every time an item was added. I changed it to maintain "servers" as a
    sorted list and insert in the correct place when an item was added. No
    more "ugggggg.. I can't move the cursor" when it finds the items
    anymore.

     
  • Michael Hoffman

    Michael Hoffman - 2003-04-28

    fstream added - some changes for unix

     
  • Michael Hoffman

    Michael Hoffman - 2003-04-28

    Logged In: YES
    user_id=619820

    Exchanged fstreams for FILE*, added some changes for Unix per lars
    suggestions. All items that are cached are greyed out & after 1/2 hour
    player counts for cached items are zeroed out -- when the cache is
    saved to disk.

     
  • Michael Hoffman

    Michael Hoffman - 2003-04-29

    fixes to make GCC happy - thanks lars

     
  • Michael Hoffman

    Michael Hoffman - 2003-05-17

    Logged In: YES
    user_id=619820

    Have tested under linux ........ seems ok.

     
  • Michael Hoffman

    Michael Hoffman - 2003-05-17
    • assigned_to: nobody --> timriker
     
  • David Trowbridge

    Logged In: YES
    user_id=66583

    updated to current CVS

     
  • David Trowbridge

    newest version (6/1)

     
  • David Trowbridge

    • status: open --> closed-accepted
     
  • David Trowbridge

    Logged In: YES
    user_id=66583

    Applied to CVS, Thanx!

     

Log in to post a comment.