Revision 1a481d7b lib/experiment.py

View differences:

lib/experiment.py
13 13
		self.sessions.append(session)
14 14
		return session
15 15

  
16
	def addr2hostname(self,addr):
16
	def addr2hostname(self,addr,without_port=False):
17 17
		hostname = None	
18
#		print "requisting hostname for addr "+addr
19 18
		for session in self.sessions:
20
			hostname = session.addr2hostname(addr)
19
			hostname = session.addr2hostname(addr.strip(),without_port)
21 20
			if hostname:
22 21
				break # I know it is horrible... stupid python!
22
		#print "hostname for addr "+addr+": "+str(hostname)
23 23
		return hostname
24 24

  
25 25
class Session:
......
42 42
				return peer
43 43
		return None
44 44

  
45
	def addr2hostname(self,addr):
45
	def addr2hostname(self,addr,without_port=False):
46 46
		hostname = None
47 47
		for peer in self.peers :
48
			if without_port and peer.address.split(':')[0] == addr:
49
				hostname = peer.hostname
48 50
			if peer.address == addr:
49 51
				hostname = peer.hostname
50 52
			if hostname:
......
59 61
		received = dataframe[dataframe['action'] == 'RECEIVED']
60 62
		sent = dataframe[dataframe['action'] == 'SENT']
61 63
		if len(received) > 0:
62
			self.address = ''.join(received['receiver'][0].split(':')[:-1])
64
			self.address = ''.join(received['receiver'][0])
63 65
		else:
64 66
			if len(sent) > 0:
65
				self.address = ''.join(sent['sender'][0].split(':')[:-1])
67
				self.address = ''.join(sent['sender'][0])
66 68
			else:
67 69
				self.address = 'unkwnon'
68 70

  

Also available in: Unified diff