MainServer

Implementation
Main server is intended to collect data from all Limit servers (local servers). It also reads and sends server rules to all subservers.
There are two threads used:
  1. Main thread:
    • after starting, reads local configuration using read_local_config(), and daemonize if necessary
    • reads rules using file specyfied in configuration. Opens databases and loads data from them if necessary. Please not that this might take a while to load huge databases.
    • creates second thread, and waits for new connections.
    • accepts any new connections and redirects them to second thread.
    • starts diff process if necessary
  2. Worker thread works in read_cb(). When new data are avialable, they are parsed by read_cb() and protocol_core()
    Depending on packet type protocol_core() could perform following operations:
    • on register request, adds proxy to proxy list (or set is as avialable, if it was already connected before), then sends entire configuration and all data necessary for them.
    • on limit_server_request_uid: Checks if user is avialable now, if so returns it to all local servers. Otherwise, attempts to fetch it from database, if successful sends reply to alll local servers. If both failed, no action is performed.
    • on limit_server_update_diff, if diff process is ongoing now, adds data. When all data are received, sends all changed entries to all servers. Finally, removes entries which are too old and violate TTL.
Additionaly, will reload server configuration after receiving SIGUSR1.
Author:
Copyright 2009 DreamLab Onet.pl Sp. z o.o.
Authors: Grzegorz Jablonski jablonski.grzegorz@gmail.com, Michal Szklarzewicz michal.szklarzewicz@gmail.com
Date:
28.09.2009

Generated on Thu Oct 22 16:30:59 2009 for Main server by  doxygen 1.5.6