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

Error while send() and poll() at same Time #72

Open
Keden92 opened this issue Feb 1, 2018 · 0 comments
Open

Error while send() and poll() at same Time #72

Keden92 opened this issue Feb 1, 2018 · 0 comments

Comments

@Keden92
Copy link

Keden92 commented Feb 1, 2018

If the poll() function is called by multithread while an other thread is "masking" the data are send only masked on the first bytes and the sendData() function crashes.

workoround (easywsclient.cpp line 410):

std::vector<uint8_t> txbuftemp; txbuftemp.insert(txbuftemp.end(), header.begin(), header.end()); txbuftemp.insert(txbuftemp.end(), message_begin, message_end); if (useMask) { size_t message_offset = txbuftemp.size() - message_size; for (size_t i = 0; i != message_size; ++i) { txbuftemp[message_offset + i] ^= masking_key[i&0x3]; } } txbuf.insert(txbuf.end(), txbuftemp.begin(), txbuftemp.end());

Second little bug:
line 489: on error if (sscanf(line, "HTTP/1.1 %d", &status) != 1 || status != 101) the socket isn't closed. By while(1){"Reconnect";} and unreachable Server, the application crashes because of "Too Many open Files".

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

1 participant