Skip to content

Commit

Permalink
grund-bus: Fix message dispatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Nov 10, 2024
1 parent f018839 commit 6a3f37b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/impls/impl-skift/async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct HjertSched : public Sys::Sched {
while (_Embed::now() < until) {
try$(_listener.poll(until));
while (auto ev = _listener.next()) {
auto &prop = _promises.get(ev->cap);
auto prop = _promises.take(ev->cap);
try$(_listener.mute(ev->cap));
prop.resolve(Ok());
}
Expand Down
5 changes: 3 additions & 2 deletions src/srvs/grund-bus/bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Async::Task<> Service::runAsync() {

Res<> Service::dispatch(Sys::Message &msg) {
logDebug("Dispatching message on service '{}'", _id);
return _con.send(msg.bytes, msg.handles);
return _con.send(sub(msg.bytes, msg.len), sub(msg.handles, msg.handlesLen));
}

// MARK: Bus -------------------------------------------------------------------
Expand All @@ -149,8 +149,9 @@ Karm::Res<> Bus::attach(Strong<Endpoint> endpoint) {
}

Res<> Bus::dispatch(Sys::Header &h, Sys::Message &msg) {
logDebug("dispatching message to {}", h.port);
for (auto &endpoint : _endpoints) {
if (endpoint->_port == h.port)
if (endpoint->port() == h.port)
return endpoint->dispatch(msg);
}
return Error::notFound("service not found");
Expand Down
2 changes: 1 addition & 1 deletion src/srvs/grund-bus/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Endpoint : public Meta::Static {
return Sys::Port{port++};
}

Sys::Port _port;
Sys::Port _port = nextPort();
Bus *_bus;

virtual ~Endpoint() = default;
Expand Down

0 comments on commit 6a3f37b

Please sign in to comment.