jonmeredith commented on a change in pull request #868:
URL: https://github.com/apache/cassandra/pull/868#discussion_r568160956



##########
File path: src/java/org/apache/cassandra/net/Message.java
##########
@@ -1285,10 +1298,18 @@ private int extractParamsSizePre40(ByteBuffer buf, int 
readerIndex, int readerLi
 
         private <T> int payloadSize(Message<T> message, int version)
         {
-            long payloadSize = message.payload != null && message.payload != 
NoPayload.noPayload
-                             ? 
message.verb().serializer().serializedSize(message.payload, version)
-                             : 0;
-            return Ints.checkedCast(payloadSize);
+            if (message.payload != null && message.payload != 
NoPayload.noPayload)
+            {
+                IVersionedAsymmetricSerializer<T,T> payloadSerializer = 
message.verb().serializer();
+                if (null == payloadSerializer) // per-response serializers are 
only required for in-jvm dtests for message filtering
+                    payloadSerializer = 
instance().callbacks.get(message.header.id, 
message.header.from).responseVerb.serializer();
+                long payloadSize = 
payloadSerializer.serializedSize(message.payload, version);
+                return Ints.checkedCast(payloadSize);
+            }
+            else
+            {
+                return 0;
+            }

Review comment:
       Yes, thanks for the patch, that's how it should be.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to