You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2020/06/10 01:02:38 UTC

[GitHub] [servicecomb-java-chassis] liubao68 commented on a change in pull request #1825: [SCB-1995]Fix incorrect message issue identifed through testing

liubao68 commented on a change in pull request #1825:
URL: https://github.com/apache/servicecomb-java-chassis/pull/1825#discussion_r437803087



##########
File path: service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/server/ServerUtil.java
##########
@@ -179,12 +179,12 @@ private static ServerMicroserviceInstance buildServerMicroserviceInstanceFromMap
 
   private static void startListenerForRegisterUnregisterEvent() {
     try {
-      byte[] buffer = new byte[DATA_PACKET_BUFFER_SIZE];
       multicastSocket = new MulticastSocket(PORT);
       group = InetAddress.getByName(GROUP);
       multicastSocket.joinGroup(group); // need to join the group to be able to receive the data
 
       while (true) {
+        byte[] buffer = new byte[DATA_PACKET_BUFFER_SIZE];
         DatagramPacket receivePacketBuffer = new DatagramPacket(buffer, buffer.length);
         multicastSocket.receive(receivePacketBuffer);
         String receivedPacketString = new String(receivePacketBuffer.getData(), ENCODE);

Review comment:
       This logic seams not correct. Maybe you'd check the length of data actually received and using the correct data. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org