Esempio n. 1
0
 private void ackPacket() {
   if (isExpectedBlockAck()) {
     if (chunker.hasNextByte()) {
       sendNextBlock();
     } else {
       // no more blocks so close adapter
       tftpadapter.close();
     }
   } else if (isWrapAround()) {
     expectedBlock = 0;
     if (chunker.hasNextByte()) {
       sendNextBlock();
     } else {
       // no more blocks so close adapter
       tftpadapter.close();
     }
   } else if (isPreviousBlockAck()) {
     log.error(
         "acknowledgment not for expected block number:"
             + expectedBlock
             + " instead, acknowledgment recieved for block number:"
             + ackpacket.getBlockNumber());
   } else if (isGreaterAckThanBlock()) {
     log.error("out of order acknowledgment recieved");
   } else {
     log.error("unexpected problem occured");
     tftpadapter.close();
   }
 }
Esempio n. 2
0
 private boolean isGreaterAckThanBlock() {
   return ackpacket.getBlockNumber() > expectedBlock;
 }
Esempio n. 3
0
 private boolean isWrapAround() {
   return 0 == ackpacket.getBlockNumber();
 }
Esempio n. 4
0
 private boolean isPreviousBlockAck() {
   return ackpacket.getBlockNumber() < expectedBlock;
 }
Esempio n. 5
0
 private boolean isExpectedBlockAck() {
   return ackpacket.getBlockNumber() == expectedBlock;
 }