summaryrefslogtreecommitdiff
path: root/cesar/maximus/python/lib/proto/maximus_proto.py
diff options
context:
space:
mode:
authorburet2008-07-18 16:02:55 +0000
committerburet2008-07-18 16:02:55 +0000
commit0b9f4bc26ef911b888026149fcdc5b052f8abafb (patch)
tree2c6a37cb5713af5eaeb0c9d8b7dd8f6e8c4dcad4 /cesar/maximus/python/lib/proto/maximus_proto.py
parent1f3cdb623f2b289a75c2326836127babeee80cc5 (diff)
[Proto] Solve bug of fcall reception in the Python library
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2634 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/maximus/python/lib/proto/maximus_proto.py')
-rw-r--r--cesar/maximus/python/lib/proto/maximus_proto.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/cesar/maximus/python/lib/proto/maximus_proto.py b/cesar/maximus/python/lib/proto/maximus_proto.py
index fce439870d..67e6d9f012 100644
--- a/cesar/maximus/python/lib/proto/maximus_proto.py
+++ b/cesar/maximus/python/lib/proto/maximus_proto.py
@@ -46,23 +46,22 @@ class Sniff(threading.Thread):
# the destination mac address to filter,
# and the FCALL to have access to the list of received MMEs
self.__maximus = maximus
+
+ # Create a socket
+ self.__my_socket = my_sniff_init(iface=self.__maximus.network_interface)
def run(self):
print "Starting sniff..."
- network_interface = self.__maximus.network_interface
- mac_address = self.__maximus.mac_address
- fcall = self.__maximus.fcall
-
while self.__run is True:
# Sniff until a MME is received
- mme = sniff(iface=network_interface, lfilter=lambda x: x.type == HPAV_MTYPE_MME and x.dst == mac_address, count=1, timeout=3)
+ mme = sniff(my_socket=self.__my_socket, lfilter=lambda x: x.type == HPAV_MTYPE_MME and x.dst == self.__maximus.mac_address, count=1, timeout=1)
if len(mme) != 0:
# When a MME is received, copy it into the list of received MMEs
# (the received MME will be processed later)
self.__maximus.semaphore.acquire()
- fcall.__class__.rsp_list.append(mme[0])
+ self.__maximus.fcall.__class__.rsp_list.append(mme[0])
self.__maximus.semaphore.release()
def stop(self):
@@ -146,7 +145,6 @@ class MaximusProto:
self.semaphore = threading.Semaphore()
self.background = Sniff(self)
self.background.start()
- sleep(1)
# Set the signal handler
signal.signal(signal.SIGINT, self.handler)