0 Replies Latest reply on Aug 6, 2009 3:36 PM by timfox

    Strange code after fix for producer window size problem

    timfox

      Just noticed this strange code committed in revision 7669 to fix the producer window size issue https://jira.jboss.org/jira/browse/JBMESSAGING-1693

      public synchronized void confirm(final Packet packet)
       {
       if (packet.getType() == PacketImpl.SESS_ACKNOWLEDGE || packet.getType() == PacketImpl.CREATESESSION || packet.getType() == PacketImpl.SESS_CREATECONSUMER
       || packet.getType() == PacketImpl.SESS_START || packet.getType() == PacketImpl.PING || packet.getType() == PacketImpl.SESS_FLOWTOKEN)
       {
       if (resendCache != null && packet.isRequiresConfirmations())
       {
       lastReceivedCommandID++;
      
       receivedBytes += packet.getPacketSize();
       if (receivedBytes >= confWindowSize)
       {
       receivedBytes = 0;
      
       if (connection.isActive())
       {
       final Packet confirmed = new PacketsConfirmedMessage(lastReceivedCommandID);
      
       confirmed.setChannelID(id);
      
       doWrite(confirmed);
       }
       }
       }
       }
       else
       {
       if (resendCache != null && packet.isRequiresConfirmations())
       {
       lastReceivedCommandID++;
      
       receivedBytes += packet.getPacketSize();
       if (receivedBytes >= confWindowSize)
       {
       receivedBytes = 0;
      
       if (connection.isActive())
       {
       final Packet confirmed = new PacketsConfirmedMessage(lastReceivedCommandID);
       confirmed.setChannelID(id);
      
       doWrite(confirmed);
       }
       }
       }
      
       }
      
       }
      


      I can't see that the if statement serves any purpose so I'm removing. I'm assuming it's a relict from debugging that got forgotten to be removed.

      I'll remove it.