ContentsIndex
Barracuda.Distributor
MaintainerHenning Guenther, Martin Wegner
Description
This is the main component of Barracuda. It contains the logic of messages flow in the application. In this case, 'message' does means DistributorMsgs rather than only protocol messages.
Synopsis
data DistributorMsg
= ProtMsg SockAddr String
| NewGUI UserID Certificate PrivateKey (ControlResponse -> IO ())
| GUIMsg UserID ControlMessage
| TimeMsg
| InfraMsg (Maybe (Set SockAddr))
type DistributorChan = Chan (UTCTime, DistributorMsg)
processMessage :: DistributorMsg -> ServerMonad ()
Documentation
data DistributorMsg
The Distributor is mainly controlled via distributor messages. They can be created and be given to the processMessage function to be processed on the ServerState.
Constructors
ProtMsg SockAddr StringA message received from the network.
NewGUI UserID Certificate PrivateKey (ControlResponse -> IO ())Signals that a new GUI was created.
GUIMsg UserID ControlMessageControlMessages from one of the connected GUIs.
TimeMsgA timer message constantly pinging the Distributor to trigger certain periodic actions like sending HELLOs, etc.
InfraMsg (Maybe (Set SockAddr))A message containing a set of SockAddresses being the list of known peers. Used for infrastructure mode.
type DistributorChan = Chan (UTCTime, DistributorMsg)
Through this channel the Distributor receives the DistributorMsgs.
processMessage :: DistributorMsg -> ServerMonad ()
Main routine of the Distributor: processMessage takes a DistributorMsg and processes it. This includes: Periodic sending of HELLOs and ROUTINGs triggered by timer messages, processing all received protocol messages and updating the stored information about the network in the ServerState respectively sending further messages (e. g. to the remaining non-local receivers). And additionally it connects the protocol backend of the program to the connected GUIs. Local users are registered to the Distributor, and the Distributor distributes all incoming messages for local users to those connected users respectively taking messages from them to be sent to the network.
Produced by Haddock version 0.8