Exemple #1
0
def teardown (self, reactor, service, line):
	try:
		descriptions,line = extract_neighbors(line)
		_,code = line.split(' ',1)
		for key in reactor.peers:
			for description in descriptions:
				if match_neighbor(description,key):
					reactor.peers[key].teardown(int(code))
					self.log_message('teardown scheduled for %s' % ' '.join(description))
		reactor.processes.answer_done(service)
		return True
	except ValueError:
		reactor.processes.answer_error(service)
		return False
	except IndexError:
		reactor.processes.answer_error(service)
		return False
Exemple #2
0
def teardown (self, reactor, service, line):
	try:
		descriptions,line = extract_neighbors(line)
		_,code = line.split(' ',1)
		for key in reactor.peers:
			for description in descriptions:
				if match_neighbor(description,key):
					reactor.peers[key].teardown(int(code))
					self.log_message('teardown scheduled for %s' % ' '.join(description))
		reactor.processes.answer_done(service)
		return True
	except ValueError:
		reactor.processes.answer(service,'error')
		return False
	except IndexError:
		reactor.processes.answer(service,'error')
		return False
Exemple #3
0
def teardown (self, reactor, service, line):
	try:
		descriptions,line = extract_neighbors(line)
		if ' ' not in line:
			reactor.processes.answer_error(service)
			return False
		_,code = line.split(' ',1)
		if not code.isdigit():
			reactor.processes.answer_error(service)
			return False
		for key in reactor.established_peers():
			for description in descriptions:
				if match_neighbor(description,key):
					reactor.teardown_peer(key,int(code))
					self.log_message('teardown scheduled for %s' % ' '.join(description))
		reactor.processes.answer_done(service)
		return True
	except ValueError:
		reactor.processes.answer_error(service)
		return False
	except IndexError:
		reactor.processes.answer_error(service)
		return False