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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary data reading is invalid #8

Merged
merged 2 commits into from Oct 5, 2018

Conversation

Projects
None yet
2 participants
@p3root

p3root commented Oct 4, 2018

Reading binary data has delivered me a lot of strange data. So a looked in the code and saw the following:
`if (!res.EndOfMessage)
{
binary.AddRange(buffer.Where(b => b != '\0'));
goto READ;
}

binary.AddRange(buffer.Where(b => b != '\0'));`

Binary data can contain also contain a lot of zeros. Ignoring here that goto is also very evil 馃檲

I have fixed it with copying the amount of data you got from the websocket to a new buffer and than add it to the byte list.

I also added a new log method. Just for performance reasons. I don't like it to generate a string of n byte data just that the log method returns anyway because logging is disabled.

Cheers,
Patrik

@p3root

This comment has been minimized.

Show comment
Hide comment
@p3root

p3root Oct 4, 2018

Would love to see that merged and deployed to nuget very soon that I can continue my work :)

p3root commented Oct 4, 2018

Would love to see that merged and deployed to nuget very soon that I can continue my work :)

@ByronAP

This comment has been minimized.

Show comment
Hide comment
@ByronAP

ByronAP Oct 4, 2018

Member

thank you, I will take a look

Member

ByronAP commented Oct 4, 2018

thank you, I will take a look

@ByronAP

This comment has been minimized.

Show comment
Hide comment
@ByronAP

ByronAP Oct 5, 2018

Member

BTW, I disagree with the use of GOTO, I understand it became a problem back in the day when people used it all over the place but it has a purpose and when not abused is a nice shortcut.

Member

ByronAP commented Oct 5, 2018

BTW, I disagree with the use of GOTO, I understand it became a problem back in the day when people used it all over the place but it has a purpose and when not abused is a nice shortcut.

@ByronAP ByronAP merged commit dc633c9 into Coinigy:master Oct 5, 2018

@p3root

This comment has been minimized.

Show comment
Hide comment
@p3root

p3root Oct 5, 2018

Thanks for the merge :)

About the GOTO, we could discuss for hours now. Just have a beer and talk about important stuff ;) Great job u made here :)

p3root commented Oct 5, 2018

Thanks for the merge :)

About the GOTO, we could discuss for hours now. Just have a beer and talk about important stuff ;) Great job u made here :)

@ByronAP

This comment has been minimized.

Show comment
Hide comment
@ByronAP

ByronAP Oct 5, 2018

Member

lol thanks man

Member

ByronAP commented Oct 5, 2018

lol thanks man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment