Skip to content
Snippets Groups Projects
Commit bdb3dedf authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix for corrupt pointer in packet receiver

parent f53652df
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
...@@ -101,7 +101,7 @@ void ftl::net::Dispatcher::dispatch_call(Peer &s, const msgpack::object &msg) { ...@@ -101,7 +101,7 @@ void ftl::net::Dispatcher::dispatch_call(Peer &s, const msgpack::object &msg) {
optional<Dispatcher::adaptor_type> ftl::net::Dispatcher::_locateHandler(const std::string &name) const { optional<Dispatcher::adaptor_type> ftl::net::Dispatcher::_locateHandler(const std::string &name) const {
auto it_func = funcs_.find(name); auto it_func = funcs_.find(name);
if (it_func == end(funcs_)) { if (it_func == funcs_.end()) {
if (parent_ != nullptr) { if (parent_ != nullptr) {
return parent_->_locateHandler(name); return parent_->_locateHandler(name);
} else { } else {
......
...@@ -86,12 +86,17 @@ void Muxer::add(Stream *s, size_t fsid) { ...@@ -86,12 +86,17 @@ void Muxer::add(Stream *s, size_t fsid) {
auto &se = streams_.emplace_back(); auto &se = streams_.emplace_back();
int i = streams_.size()-1; int i = streams_.size()-1;
se.stream = s; se.stream = s;
ftl::stream::Muxer::StreamEntry *ptr = &se;
handles_.push_back(std::move(s->onPacket([this,s,i,fsid,ptr](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { handles_.push_back(std::move(s->onPacket([this,s,i,fsid](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
//TODO: Allow input streams to have other streamIDs //TODO: Allow input streams to have other streamIDs
// Same fsid means same streamIDs map together in the end // Same fsid means same streamIDs map together in the end
ftl::stream::Muxer::StreamEntry *ptr = nullptr;
{
SHARED_LOCK(mutex_,lk);
ptr = &streams_[i];
}
ftl::codecs::StreamPacket spkt2 = spkt; ftl::codecs::StreamPacket spkt2 = spkt;
ptr->original_fsid = spkt.streamID; ptr->original_fsid = spkt.streamID;
spkt2.streamID = fsid; spkt2.streamID = fsid;
......
...@@ -427,6 +427,13 @@ std::unordered_set<ftl::codecs::Channel> Frame::allChannels() const { ...@@ -427,6 +427,13 @@ std::unordered_set<ftl::codecs::Channel> Frame::allChannels() const {
res.emplace(k); res.emplace(k);
} }
} }
uint64_t m = 1;
// TODO: NAIVE, use ffs or ctz.
for (int i=0; i<32; ++i) {
if (m & available_) res.emplace(static_cast<Channel>(i));
m <<= 1;
}
return res; return res;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment