Github user vijikarthi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2425#discussion_r84169656
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyMessage.java
 ---
    @@ -57,24 +61,37 @@
        // constructor in order to work with the generic deserializer.
        // 
------------------------------------------------------------------------
     
    -   static final int HEADER_LENGTH = 4 + 4 + 1; // frame length (4), magic 
number (4), msg ID (1)
    +   static final int HEADER_LENGTH = 4 + 4 + 4 + 1; // frame length (4), 
magic number (4), Cookie (4), msg ID (1)
     
        static final int MAGIC_NUMBER = 0xBADC0FFE;
     
    +   static final int BUFFER_SIZE = 65536;
    +
    +   static final Charset DEFAULT_CHARSET = Charset.forName("utf-8");
    +
        abstract ByteBuf write(ByteBufAllocator allocator) throws Exception;
     
        abstract void readFrom(ByteBuf buffer) throws Exception;
     
        // 
------------------------------------------------------------------------
     
    -   private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte 
id) {
    -           return allocateBuffer(allocator, id, 0);
    +   private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte 
id, String secureCookie) {
    +           return allocateBuffer(allocator, id, secureCookie, 0);
        }
     
    -   private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte 
id, int length) {
    +   private static ByteBuf allocateBuffer(ByteBufAllocator allocator, byte 
id, String secureCookie, int length) {
    +           secureCookie = (secureCookie == null || secureCookie.length() 
== 0) ? "": secureCookie;
    +           length+=secureCookie.getBytes().length;
                final ByteBuf buffer = length != 0 ? 
allocator.directBuffer(HEADER_LENGTH + length) : allocator.directBuffer();
                buffer.writeInt(HEADER_LENGTH + length);
                buffer.writeInt(MAGIC_NUMBER);
    +
    +           buffer.writeInt(secureCookie.length());
    --- End diff --
    
    Good catch. Will change it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to