make DockOutPort deal with the case where it has no peer
authoradam <adam@megacz.com>
Tue, 4 Nov 2008 07:09:46 +0000 (08:09 +0100)
committeradam <adam@megacz.com>
Tue, 4 Nov 2008 07:09:46 +0000 (08:09 +0100)
src/edu/berkeley/fleet/ir/Process.java

index 19b3079..b160757 100644 (file)
@@ -225,11 +225,12 @@ public class Process {
                         reset_count++;
                         Context.LoopFactory lf = ctx.new LoopFactory(dock, 1);
 
-                        //System.out.println("absorbing tokens from " + dip_peer.dock + " to " + dock + "(a "+Module.this.getClass().getName()+")");
-                        for(int i=0; i<peer.getTokensToAbsorb(); i++) {
-                            lf.recvToken();
+                        if (peer != null) {
+                            for(int i=0; i<peer.getTokensToAbsorb(); i++) {
+                                lf.recvToken();
+                            }
+                            //lf.sendToken(dip_peer.dock.getInstructionDestination());
                         }
-                        //lf.sendToken(dip_peer.dock.getInstructionDestination());
 
                         lf.sendToken(fleet.getShip("Debug",0).getDock("in").getDataDestination());
                         lf = lf.makeNext(0);