Skip to content

Commit 6e7b244

Browse files
authored
Calculate the initial frame size of the client messages correctly (#494)
While calculating the initial frame size of the client messages, we were adding SIZE_OF_FRAME_LENGTH_AND_FLAGS twice. That extra addition is removed from the create_initial_buffer. To make the create_initial_buffer_custom alike, I also removed the addition from there, although there was no such problem for that method. To make it work again, I have modified the protocol template to perform one less subtraction of SIZE_OF_FRAME_LENGTH_AND_FLAGS from the initial frame size. Also, bumped the client version to 4.2.2, as it is the version that we will release the next.
1 parent 0bc4796 commit 6e7b244

18 files changed

+88
-19
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272
# built documents.
7373
#
7474
# The short X.Y version.
75-
version = "4.2.1"
75+
version = "4.2.2"
7676
# The full version, including alpha/beta/rc tags.
77-
release = "4.2.1"
77+
release = "4.2.2"
7878

7979
autodoc_member_order = "bysource"
8080
autoclass_content = "both"

hazelcast/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "4.2.1"
1+
__version__ = "4.2.2"
22

33
# Set the default handler to "hazelcast" loggers
44
# to avoid "No handlers could be found" warnings.

hazelcast/protocol/client_message.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
# For codecs
3636
def create_initial_buffer(size, message_type, is_final=False):
37-
size += SIZE_OF_FRAME_LENGTH_AND_FLAGS
3837
buf = bytearray(size)
3938
LE_INT.pack_into(buf, 0, size)
4039
flags = _UNFRAGMENTED_MESSAGE_FLAGS
@@ -48,7 +47,6 @@ def create_initial_buffer(size, message_type, is_final=False):
4847

4948
# For custom codecs
5049
def create_initial_buffer_custom(size, is_begin_frame=False):
51-
size += SIZE_OF_FRAME_LENGTH_AND_FLAGS
5250
if is_begin_frame:
5351
# Needed for custom codecs that does not have initial frame at first
5452
# but requires later due to new fix sized parameters

hazelcast/protocol/codec/custom/address_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
_PORT_ENCODE_OFFSET = 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
88
_PORT_DECODE_OFFSET = 0
9-
_INITIAL_FRAME_SIZE = _PORT_ENCODE_OFFSET + INT_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
9+
_INITIAL_FRAME_SIZE = _PORT_ENCODE_OFFSET + INT_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1010

1111

1212
class AddressCodec(object):

hazelcast/protocol/codec/custom/bitmap_index_options_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
_UNIQUE_KEY_TRANSFORMATION_ENCODE_OFFSET = 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
88
_UNIQUE_KEY_TRANSFORMATION_DECODE_OFFSET = 0
9-
_INITIAL_FRAME_SIZE = _UNIQUE_KEY_TRANSFORMATION_ENCODE_OFFSET + INT_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
9+
_INITIAL_FRAME_SIZE = _UNIQUE_KEY_TRANSFORMATION_ENCODE_OFFSET + INT_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1010

1111

1212
class BitmapIndexOptionsCodec(object):

hazelcast/protocol/codec/custom/endpoint_qualifier_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
_TYPE_ENCODE_OFFSET = 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
88
_TYPE_DECODE_OFFSET = 0
9-
_INITIAL_FRAME_SIZE = _TYPE_ENCODE_OFFSET + INT_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
9+
_INITIAL_FRAME_SIZE = _TYPE_ENCODE_OFFSET + INT_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1010

1111

1212
class EndpointQualifierCodec(object):

hazelcast/protocol/codec/custom/error_holder_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
_ERROR_CODE_ENCODE_OFFSET = 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
1010
_ERROR_CODE_DECODE_OFFSET = 0
11-
_INITIAL_FRAME_SIZE = _ERROR_CODE_ENCODE_OFFSET + INT_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
11+
_INITIAL_FRAME_SIZE = _ERROR_CODE_ENCODE_OFFSET + INT_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1212

1313

1414
class ErrorHolderCodec(object):

hazelcast/protocol/codec/custom/index_config_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
_TYPE_ENCODE_OFFSET = 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
1010
_TYPE_DECODE_OFFSET = 0
11-
_INITIAL_FRAME_SIZE = _TYPE_ENCODE_OFFSET + INT_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
11+
_INITIAL_FRAME_SIZE = _TYPE_ENCODE_OFFSET + INT_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1212

1313

1414
class IndexConfigCodec(object):

hazelcast/protocol/codec/custom/member_info_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
_UUID_DECODE_OFFSET = 0
1313
_LITE_MEMBER_ENCODE_OFFSET = _UUID_ENCODE_OFFSET + UUID_SIZE_IN_BYTES
1414
_LITE_MEMBER_DECODE_OFFSET = _UUID_DECODE_OFFSET + UUID_SIZE_IN_BYTES
15-
_INITIAL_FRAME_SIZE = _LITE_MEMBER_ENCODE_OFFSET + BOOLEAN_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
15+
_INITIAL_FRAME_SIZE = _LITE_MEMBER_ENCODE_OFFSET + BOOLEAN_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1616

1717

1818
class MemberInfoCodec(object):

hazelcast/protocol/codec/custom/member_version_codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
_MINOR_DECODE_OFFSET = _MAJOR_DECODE_OFFSET + BYTE_SIZE_IN_BYTES
1010
_PATCH_ENCODE_OFFSET = _MINOR_ENCODE_OFFSET + BYTE_SIZE_IN_BYTES
1111
_PATCH_DECODE_OFFSET = _MINOR_DECODE_OFFSET + BYTE_SIZE_IN_BYTES
12-
_INITIAL_FRAME_SIZE = _PATCH_ENCODE_OFFSET + BYTE_SIZE_IN_BYTES - 2 * SIZE_OF_FRAME_LENGTH_AND_FLAGS
12+
_INITIAL_FRAME_SIZE = _PATCH_ENCODE_OFFSET + BYTE_SIZE_IN_BYTES - SIZE_OF_FRAME_LENGTH_AND_FLAGS
1313

1414

1515
class MemberVersionCodec(object):

0 commit comments

Comments
 (0)