Skip to content

Commit

Permalink
fix Flush
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkingsugar committed Jun 5, 2024
1 parent 649a196 commit d74f254
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shards/modules/channels/channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ std::shared_ptr<Channel> get(const std::string &name) {
// flush/cleanup a channel
struct Flush : public Base {
std::shared_ptr<Channel> _channel;
ChannelShared *_mpChannel{};
MPMCChannel *_mpChannel{};

static inline Parameters flushParams{
{"Name", SHCCSTR("The name of the channel."), {CoreInfo::StringType}},
Expand Down Expand Up @@ -526,10 +526,10 @@ struct Flush : public Base {
_mpChannel = std::visit(
[&](auto &arg) {
using T = std::decay_t<decltype(arg)>;
if (std::is_same_v<T, DummyChannel>) {
throw SHException("Expected a valid channel.");
if (std::is_same_v<T, MPMCChannel>) {
return (MPMCChannel *)&arg;
} else {
return (ChannelShared *)&arg;
throw ActivationError("Expected a valid non-broadcast channel.");
}
},
*_channel.get());
Expand Down

0 comments on commit d74f254

Please sign in to comment.