Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove message size restriction #84

Open
LivInTheLookingGlass opened this issue Sep 1, 2016 · 3 comments
Open

Remove message size restriction #84

LivInTheLookingGlass opened this issue Sep 1, 2016 · 3 comments
Labels

Comments

@LivInTheLookingGlass
Copy link
Collaborator

LivInTheLookingGlass commented Sep 1, 2016

There are multiple proposals on the table for how to do this. I will summarize the two in comments below. connects to #69

@LivInTheLookingGlass
Copy link
Collaborator Author

Proposal 1:

Change how the initial message header is constructed. To get the initial header, the following script would work:

def how_many_bytes(i):
    num_bytes = 0
    while i:
        i >>= 8
        num_bytes += 1
    return num_bytes

def pack_header(i):
    lengths = [i]
    string = b""
    while i != 1 or lengths == [1]:
        i = how_many_bytes(lengths[-1])
        lengths.append(i)
    for index, length in enumerate(lengths[:-1]):
        print("Packing %i into %i bytes" % (length, lengths[index + 1]))
        string = pack_value(lengths[index + 1], length) + string
    return b'\x01' + string

This expands the possible message length to infinite scale. This proposal assumes that all headers are structured this way, including the packet separators.

@LivInTheLookingGlass
Copy link
Collaborator Author

LivInTheLookingGlass commented Sep 1, 2016

Proposal 2:

  1. Keep the 4GiB message limit
  2. Add a continuation flag, which, if at the beginning of a message, specifies a message ID that it is extending, or if at the end of a message, specifies the message that will continue it
  3. Have the .string call return a list of strings if this occurs

@LivInTheLookingGlass
Copy link
Collaborator Author

LivInTheLookingGlass commented Oct 12, 2016

Issues #82, #83, #93, and #100 likely make this problem more difficult

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant