示例#1
0
 def perspective_register(self, name, port, load, role):
     self.name = name
     peer = Peers.selectBy(name = name)
     if peer.count() != 0: raise PeerRegistrationError("Peer Existed")
     info = self.mind.broker.transport.getPeer()
     if not info: raise PeerRegistrationError("Bad peer information")
     self.peerDB = Peers(name=name, ipAddress=info.host, port=port, load=load, role=role, uniqId=self.uniqId)
     return True
示例#2
0
 def logout(self):
     if self.peerDB:
         Peers.delete(self.peerDB.id)
         self.peerDB = None
     self.realm.logout(self)
示例#3
0
 def perspective_getWorldList(self):
     worldList = {}
     rows = Peers.selectBy(role = PeerType.World)
     for row in rows:
         worldList[row.uniqId] = row.name
     return worldList