Lachee / discord-rpc-csharp

C# custom implementation for Discord Rich Presence. Not deprecated and still available!
MIT License
560 stars 93 forks source link

[BUG] PipeFrame.ReadStream() fails at times #172

Closed ronfrigginjon closed 1 year ago

ronfrigginjon commented 2 years ago

Describe the bug This is happening on the message-listener branch PipeFrame.ReadStream() at times returns false when the byte[] result Length does not equal the stream length.

This is Logging an ERROR in ManagedNamedPiepClient.cs of "Pipe failed to read from the data received by the stream." as the ReadStream returns false and hits the else condition.

To Reproduce Steps to reproduce the behavior: This seems to be an intermittent problem and have yet found a way to reproduce it consistently. I am occasionally missing important messages from discord because of this issue.

Expected behavior The message to be read and enqueued

Desktop (please complete the following information):

Logs Didn't send message INFO: Checking command queue INFO: Checking command queue TRCE: Ending Read TRCE: Read 2275 bytes ERR : Pipe failed to read from the data received by the stream. TRCE: Starting another read TRCE: Begining Read of 16384 bytes INFO: Checking command queue INFO: Checking command queue INFO: Checking command queue

Worked and sent the message INFO: Checking command queue TRCE: Ending Read TRCE: Read 1847 bytes TRCE: Read a frame: Frame TRCE: Starting another read TRCE: Begining Read of 16384 bytes TRCE: Read Payload: Frame INFO: Handling Response. Cmd: Dispatch, Event: MessageCreate TRCE: Incoming Message: @everyone Still plenty of spots available in our weekly bingo contest

Lachee commented 2 years ago

I have committed a small change that will make it not as strict when reading some messages. Please try this change.

ronfrigginjon commented 1 year ago

This issue was resolved. I was just able to increase the byte buffer min size from 2048 to 4096. Thanks for support