def toldBandwidth(self, bandwidth): fi.logmsg(self.__class__, "Told %dkbps" % bandwidth) ThrottleApplication.throttle( ((fi.throttle.VPN_SERVER_IP, bandwidth),) ) self.gotRoot(self.root)
def update(cls): # Schedule credits = [] for client in fi.throttle.model.Client.query.all(): credits.append((client.vpn_ip, client.credit)) allocations = ThrottleApplication.schedule(credits) # Update memory fi.throttle.model.Client.allocate(allocations) # Perform network throttling ThrottleApplication.throttle(allocations) fi.callLater(cls.update)
def gotRoot(self, root): self.root = root # Start once pathloading to server ThrottleApplication.pathloadSend() fi.callLater(self.askBandwidth)