public void up(MessageBatch batch) { for (Message msg : batch) { NakAckHeader2 hdr = (NakAckHeader2) msg.getHeader(ID); if (hdr != null && hdr.getType() == NakAckHeader2.MSG) { long seqno = hdr.getSeqno(); msgs.add(seqno); System.out.println("-- received message #" + seqno + " from " + msg.getSrc()); } } }
public Object up(Event evt) { switch (evt.getType()) { case Event.MSG: Message msg = (Message) evt.getArg(); NakAckHeader2 hdr = (NakAckHeader2) msg.getHeader(ID); if (hdr != null && hdr.getType() == NakAckHeader2.MSG) { long seqno = hdr.getSeqno(); msgs.add(seqno); System.out.println("-- received message #" + seqno + " from " + msg.getSrc()); } break; } return null; }
public Object down(Event evt) { switch (evt.getType()) { case Event.MSG: Message msg = (Message) evt.getArg(); NakAckHeader2 hdr = (NakAckHeader2) msg.getHeader(ID); if (hdr == null) break; if (hdr.getType() == NakAckHeader2.XMIT_REQ) { SeqnoList seqnos = (SeqnoList) msg.getObject(); System.out.println("-- XMIT-REQ: request retransmission for " + seqnos); for (Long seqno : seqnos) xmit_requests.add(seqno); } break; } return null; }