putMemoryShipInDispatchMode() now puts both out and inCBD in infinite-recieve mode
[fleet.git] / src / edu / berkeley / fleet / loops / MemoryUtils.java
index 78d80f0..f8c5163 100644 (file)
@@ -117,15 +117,23 @@ public class MemoryUtils {
     public static void putMemoryShipInDispatchMode(FleetProcess fp, Ship memoryShip) {
         Context ctx = new Context(fp.getFleet());
         LoopFactory lf;
+
         lf = new LoopFactory(ctx, memoryShip.getDock("out"), 0);
         lf.abortLoopIfTorpedoPresent();
         lf.collectPacket();
         lf.sendWord(null);
+
+        lf = new LoopFactory(ctx, memoryShip.getDock("inCBD"), 0);
+        lf.abortLoopIfTorpedoPresent();
+        lf.recvWord();
+        lf.deliver();
+
         ctx.dispatch(fp);
     }
 
     public static void removeMemoryShipFromDispatchMode(FleetProcess fp, Ship memoryShip) {
         fp.sendToken(memoryShip.getDock("out").getInstructionDestination());
+        fp.sendToken(memoryShip.getDock("inCBD").getInstructionDestination());
     }
 
     public static void main(String[] s) throws Exception {