Revision a60088f6 lib/experiment.py

View differences:

lib/experiment.py
1 1
class Experiment:
2
	TIME_SENSIBILITY = 300
2
	TIME_SENSIBILITY = 30
3 3

  
4 4
	def __init__(self):
5 5
		self.sessions = []
6 6

  
7
	def getSession(self,time):
7
	def removeSessionByTime(self,session_time):
8
		for session in self.sessions:
9
			if session.time < (session_time + 5) and session.time > (session_time-5):
10
				self.sessions.remove(session)
11

  
12
	def getSession(self,time,creation=False):
8 13
		for session in self.sessions:
9 14
			if ((session.time < (int(time)+Experiment.TIME_SENSIBILITY)) 
10 15
			and (session.time > (int(time)-Experiment.TIME_SENSIBILITY))):
11 16
				return session
12
		session = Session(time)
13
		self.sessions.append(session)
14
		return session
17
		if creation:
18
			session = Session(time)
19
			self.sessions.append(session)
20
			return session
21
		else:
22
			return None
15 23

  
16 24
	def addr2hostname(self,addr,without_port=False):
17 25
		hostname = None	

Also available in: Unified diff