Skip to content
Snippets Groups Projects
Commit 80b6a94b authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

datatransfer: use non-blocking read on rx side


PeerConnection eventloop was blocked on receiver side
on a read() call.
Use a polling method to let possiblity to event msg to
be handled.
This fix non-working data transfer cancelation.

Change-Id: I602b6ba27091e59ad0978f4e4023204d39ee8223
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent 1a8b52c3
Branches
No related tags found
No related merge requests found
......@@ -578,9 +578,12 @@ PeerConnection::PeerConnectionImpl::eventLoop()
throw std::system_error(ec);
});
handle_stream_list(outputs_, [&](auto& stream) {
if (endpoint_->waitForData(10, ec) > 0) {
auto size = endpoint_->read(buf, ec);
if (!ec)
return size > 0 and stream->write(buf);
} else if (!ec)
return true; // continue on msg handling
throw std::system_error(ec);
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment