Exemple #1
0
func setConfig(srpcClient *srpc.Client) error {
	var config sub.Configuration
	config.ScanSpeedPercent = *scanSpeedPercent
	config.NetworkSpeedPercent = *networkSpeedPercent
	config.ScanExclusionList = scanExcludeList
	return client.SetConfiguration(srpcClient, config)
}
Exemple #2
0
func (sub *Sub) updateConfiguration(srpcClient *srpc.Client,
	pollReply subproto.PollResponse) {
	if pollReply.ScanCount < 1 {
		return
	}
	sub.herd.RLock()
	newConf := sub.herd.configurationForSubs
	sub.herd.RUnlock()
	if compareConfigs(pollReply.CurrentConfiguration, newConf) {
		return
	}
	if err := client.SetConfiguration(srpcClient, newConf); err != nil {
		srpcClient.Close()
		logger := sub.herd.logger
		logger.Printf("Error setting configuration for sub: %s: %s\n",
			sub, err)
		return
	}
}