Uploaded image for project: 'Hama'
  1. Hama
  2. HAMA-482

LocalBSPRunner cannot deliver multiple messages to the same peer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.4.0
    • None
    • None

    Description

      the line 331 of LocalBSPRunner contains a warning which may result in bugs with multiple messages.
      In fact

      LinkedList<BSPMessage> msgs = localOutgoingMessages.get(peerName);
      

      is trying to get a List of BSPMessage instances from a localOutgoingMessages of type

      HashMap<InetSocketAddress, LinkedList<BSPMessage>>

      .

      It seems to me there is problem as peerName is a String, not a InetSocketAddress and in fact my debugging session highlighted that get() method to result always to return a null object.

      The quick fix seems to be putting the lines 337-341 :

            InetSocketAddress inetSocketAddress = socketCache.get(peerName);
            if (inetSocketAddress == null) {
              inetSocketAddress = BSPNetUtils.getAddress(peerName);
              socketCache.put(peerName, inetSocketAddress);
            }
      

      upmost in the method and then call

      LinkedList<BSPMessage> msgs = localOutgoingMessages.get(inetSocketAddress);
      

      This was highlighted when dealing with multiple messages sent to a same peer in local mode (only the last msg was actually stored in the outGoingMessages item for that peer).

      Attachments

        Activity

          People

            teofili Tommaso Teofili
            teofili Tommaso Teofili
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: