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

Received message by server is kept in memory. How to clear? #115

Open
huguesl opened this issue Jul 1, 2021 · 2 comments
Open

Received message by server is kept in memory. How to clear? #115

huguesl opened this issue Jul 1, 2021 · 2 comments

Comments

@huguesl
Copy link

huguesl commented Jul 1, 2021

I have a Server receiving messages from a client in Unity, setup like the example in the wiki.
I am sending two different messages on two different key presses, one on space bar press and the other on Q key press.
The message on space bar press is longer than the message on Q press.

Space bar message, server receives: "Client sends message on Space key press."
Q key message, server receives: "Beep beep beep on Q key press!"

If I press space bar first, and send the above message, and then press on Q, the server receives:
"Beep beep beep on Q key press!key press.", which shows that the previous message, sent on space bar was not cleared.
Is this a defect? How do you clear previous messages if not a defect?

Thank you.

@ZTMC
Copy link

ZTMC commented Jul 29, 2021

I had the same problem. Go to MagnificentReceivePipe.cs, find the Enqueue method, and clear the byte[] bytes after taking it from the pool. Just traverse it.

for (int i = 0; i < bytes.Length; i++)
    bytes[i] = default;

PhantomGamers added a commit to PhantomGamers/nebula that referenced this issue Aug 6, 2021
@huguesl
Copy link
Author

huguesl commented Aug 14, 2021

Awesome, thank you @ZTMC.

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

No branches or pull requests

2 participants