You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/08/06 03:25:36 UTC

[GitHub] [pulsar-client-go] wolfstudy commented on a change in pull request #42: [issue:40]Fix producer send protocol error

wolfstudy commented on a change in pull request #42: [issue:40]Fix producer send protocol error
URL: https://github.com/apache/pulsar-client-go/pull/42#discussion_r310868412
 
 

 ##########
 File path: pulsar/internal/commands.go
 ##########
 @@ -163,24 +164,26 @@ func ParseMessage(headersAndPayload []byte) (msgMeta *pb.MessageMetadata, payloa
 		return nil, nil, err
 	}
 
-    batchLen := make([]byte, 2)
-    if _, err = io.ReadFull(lr, batchLen); err != nil {
+    // Anything left in the frame is considered
+    // the payload and can be any sequence of bytes.
+    payloads := make([]byte, lr.N)
+    if _, err = io.ReadFull(lr, payloads); err != nil {
         return nil, nil, err
     }
 
-    // Anything left in the frame is considered
-    // the payload and can be any sequence of bytes.
-	if lr.N > 0 {
-		// guard against allocating large buffer
-		if lr.N > MaxFrameSize {
-			return nil, nil, fmt.Errorf("frame payload size (%d) "+
-					"cannot be greater than max frame size (%d)", lr.N, MaxFrameSize)
-		}
-		payload = make([]byte, lr.N)
-		if _, err = io.ReadFull(lr, payload); err != nil {
-			return nil, nil, err
-		}
-	}
+    numMsg := msgMeta.GetNumMessagesInBatch()
 
 Review comment:
   Yes, will run `gofmt` to check code format.

----------------------------------------------------------------
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


With regards,
Apache Git Services