Package CyberRail :: Package mainModule :: Module MainModule :: Class MainModule
[hide private]
[frames] | no frames]

Class MainModule

source code

Instance Methods [hide private]
 
__init__(self, comManager) source code
 
errorMessage(self, errorMsg) source code
 
dispatch(self, message, socket=None) source code
 
generateNewModuleMessage(self, newModule) source code
 
generateDisconnectedModuleMessage(self, discModule) source code
 
sendWelcomeMessage(self, event) source code
 
manageLeader(self, line, disconnection)
5 cases :
source code
 
promoteLeader(self, module, line) source code
 
getBanner(self) source code
 
eventReceived(self, event)
What to do when an event is dispatched.
source code
Method Details [hide private]

manageLeader(self, line, disconnection)

source code 

5 cases :

  1. new connection, no leader since this is the first module of the group -> it is the leader
  2. new connection, another module in the group -> this not the leader, and no change
  3. disconnection, no more module in the group -> nothing to do
  4. disconnection, not a leader -> nothing to do
  5. disconnection, module was leader -> leader has to be someone else

eventReceived(self, event)

source code 

What to do when an event is dispatched.

line is a dict containing infos about the managed connection, if any