summaryrefslogtreecommitdiff
path: root/host/mex/mex
diff options
context:
space:
mode:
authorNicolas Schodet2008-03-31 18:42:58 +0200
committerNicolas Schodet2008-03-31 18:42:58 +0200
commit89a5f31634fb9b8d3a6774b027be6ae01f21de42 (patch)
tree542777fde5e60ac085657e8aaa05e9b66c9789b4 /host/mex/mex
parente332353ccadd10fda96d2c02dddc64de0dbdea49 (diff)
* host/mex:
- added DATE request. - start node only when date has been received.
Diffstat (limited to 'host/mex/mex')
-rw-r--r--host/mex/mex/hub.py4
-rw-r--r--host/mex/mex/node.py5
2 files changed, 9 insertions, 0 deletions
diff --git a/host/mex/mex/hub.py b/host/mex/mex/hub.py
index 79b18286..5255ae1d 100644
--- a/host/mex/mex/hub.py
+++ b/host/mex/mex/hub.py
@@ -143,6 +143,10 @@ class Hub:
assert self.wait_date >= self.hub.date
else:
self.wait_date = None
+ elif m.mtype == mex.DATE:
+ date = Msg (mex.DATE)
+ date.push ('L', self.hub.date)
+ self.send (date)
elif m.mtype == mex.REQ:
m.pop ('B')
mr = Msg (mex.REQ)
diff --git a/host/mex/mex/node.py b/host/mex/mex/node.py
index 15cc5c2e..aa980c61 100644
--- a/host/mex/mex/node.py
+++ b/host/mex/mex/node.py
@@ -44,6 +44,11 @@ class Node:
self.handlers = { }
self.register (mex.DATE, lambda msg: self.handle_DATE (msg))
self.register (mex.REQ, lambda msg: self.handle_REQ (msg))
+ # Synchronise.
+ rsp = None
+ while rsp == None or rsp.mtype != mex.DATE:
+ rsp = self.recv ()
+ self.dispatch (rsp)
def wait (self, date = None):
"""Wait forever or until a date is reached."""