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

feat: Enable binary packets, while handling partial packets #431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/internal/sio_packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ namespace sio
bool packet::parse_buffer(const string &buf_payload)
{
if (_pending_buffers > 0) {
assert(is_binary_message(buf_payload));//this is ensured by outside.
_buffers.push_back(std::make_shared<string>(buf_payload.data(),buf_payload.size()));
_pending_buffers--;
if (_pending_buffers == 0) {
Expand Down Expand Up @@ -470,7 +469,7 @@ namespace sio
unique_ptr<packet> p;
do
{
if(packet::is_text_message(payload))
if(packet::is_text_message(payload) && !(m_partial_packet))
{
p.reset(new packet());
if(p->parse(payload))
Expand All @@ -482,7 +481,7 @@ namespace sio
break;
}
}
else if(packet::is_binary_message(payload))
else if(packet::is_binary_message(payload) || (m_partial_packet) )
{
if(m_partial_packet)
{
Expand Down