make OperationBase::channelName constant
This commit is contained in:
+2
-1
@@ -310,9 +310,10 @@ void ResultWaiter::complete(Result&& result, bool interrupt)
|
||||
notify.signal();
|
||||
}
|
||||
|
||||
OperationBase::OperationBase(operation_t op, const evbase& loop)
|
||||
OperationBase::OperationBase(operation_t op, const evbase& loop, const std::string &name)
|
||||
:Operation(op)
|
||||
,loop(loop)
|
||||
,channelName(name)
|
||||
{}
|
||||
|
||||
OperationBase::~OperationBase() {}
|
||||
|
||||
@@ -15,8 +15,8 @@ DEFINE_LOGGER(io, "pvxs.client.io");
|
||||
namespace pvxs {
|
||||
namespace client {
|
||||
|
||||
Discovery::Discovery(const std::shared_ptr<ContextImpl> &context)
|
||||
:OperationBase (Operation::Discover, context->tcp_loop)
|
||||
Discovery::Discovery(const std::shared_ptr<ContextImpl> &context, const std::string& name)
|
||||
:OperationBase (Operation::Discover, context->tcp_loop, name)
|
||||
,context(context)
|
||||
{}
|
||||
|
||||
@@ -63,7 +63,7 @@ std::shared_ptr<Operation> DiscoverBuilder::exec()
|
||||
auto context(ctx->impl->shared_from_this());
|
||||
auto ping(_ping);
|
||||
|
||||
auto op(std::make_shared<Discovery>(context));
|
||||
auto op(std::make_shared<Discovery>(context, std::string()));
|
||||
op->notify = std::move(_fn);
|
||||
|
||||
auto syncCancel(_syncCancel);
|
||||
|
||||
+5
-6
@@ -134,8 +134,8 @@ struct GPROp : public OperationBase
|
||||
|
||||
INST_COUNTER(GPROp);
|
||||
|
||||
GPROp(operation_t op, const evbase& loop)
|
||||
:OperationBase (op, loop)
|
||||
GPROp(operation_t op, const evbase& loop, const std::string& name)
|
||||
:OperationBase (op, loop, name)
|
||||
{}
|
||||
~GPROp() {
|
||||
if(loop.assertInRunningLoop())
|
||||
@@ -584,7 +584,6 @@ std::shared_ptr<Operation> gpr_setup(const std::shared_ptr<ContextImpl>& context
|
||||
{
|
||||
auto internal(std::move(op));
|
||||
internal->internal_self = internal;
|
||||
internal->channelName = name;
|
||||
|
||||
std::shared_ptr<GPROp> external(internal.get(), [internal, syncCancel](GPROp*) mutable {
|
||||
// (maybe) user thread
|
||||
@@ -626,7 +625,7 @@ std::shared_ptr<Operation> GetBuilder::_exec_get()
|
||||
|
||||
auto context(ctx->impl->shared_from_this());
|
||||
|
||||
auto op(std::make_shared<GPROp>(Operation::Get, context->tcp_loop));
|
||||
auto op(std::make_shared<GPROp>(Operation::Get, context->tcp_loop, _name));
|
||||
op->setDone(std::move(_result), std::move(_onInit));
|
||||
op->autoExec = _autoexec;
|
||||
op->pvRequest = _buildReq();
|
||||
@@ -641,7 +640,7 @@ std::shared_ptr<Operation> PutBuilder::exec()
|
||||
|
||||
auto context(ctx->impl->shared_from_this());
|
||||
|
||||
auto op(std::make_shared<GPROp>(Operation::Put, context->tcp_loop));
|
||||
auto op(std::make_shared<GPROp>(Operation::Put, context->tcp_loop, _name));
|
||||
op->setDone(std::move(_result), std::move(_onInit));
|
||||
|
||||
if(_builder) {
|
||||
@@ -673,7 +672,7 @@ std::shared_ptr<Operation> RPCBuilder::exec()
|
||||
|
||||
auto context(ctx->impl->shared_from_this());
|
||||
|
||||
auto op(std::make_shared<GPROp>(Operation::RPC, context->tcp_loop));
|
||||
auto op(std::make_shared<GPROp>(Operation::RPC, context->tcp_loop, _name));
|
||||
op->setDone(std::move(_result), nullptr);
|
||||
if(_argument) {
|
||||
if(!_autoexec)
|
||||
|
||||
+3
-3
@@ -44,15 +44,15 @@ struct ResultWaiter {
|
||||
struct OperationBase : public Operation
|
||||
{
|
||||
const evbase loop;
|
||||
const std::string channelName;
|
||||
// remaining members only accessibly from loop worker
|
||||
std::shared_ptr<Channel> chan;
|
||||
std::string channelName;
|
||||
uint32_t ioid = 0;
|
||||
Value result;
|
||||
bool done = false;
|
||||
std::shared_ptr<ResultWaiter> waiter;
|
||||
|
||||
OperationBase(operation_t op, const evbase& loop);
|
||||
OperationBase(operation_t op, const evbase& loop, const std::string& name);
|
||||
virtual ~OperationBase();
|
||||
|
||||
virtual void createOp() =0;
|
||||
@@ -231,7 +231,7 @@ struct Discovery final : public OperationBase
|
||||
std::function<void(const Discovered &)> notify;
|
||||
bool running = false;
|
||||
|
||||
Discovery(const std::shared_ptr<ContextImpl>& context);
|
||||
Discovery(const std::shared_ptr<ContextImpl>& context, const std::string& name);
|
||||
~Discovery();
|
||||
|
||||
virtual bool cancel() override final;
|
||||
|
||||
@@ -30,8 +30,8 @@ struct InfoOp : public OperationBase
|
||||
|
||||
INST_COUNTER(InfoOp);
|
||||
|
||||
explicit InfoOp(const evbase& loop)
|
||||
:OperationBase(Info, loop)
|
||||
explicit InfoOp(const evbase& loop, const std::string& name)
|
||||
:OperationBase(Info, loop, name)
|
||||
{}
|
||||
|
||||
virtual ~InfoOp()
|
||||
@@ -187,7 +187,7 @@ std::shared_ptr<Operation> GetBuilder::_exec_info()
|
||||
|
||||
auto context(ctx->impl->shared_from_this());
|
||||
|
||||
auto op(std::make_shared<InfoOp>(context->tcp_loop));
|
||||
auto op(std::make_shared<InfoOp>(context->tcp_loop, _name));
|
||||
if(_result) {
|
||||
op->done = std::move(_result);
|
||||
} else {
|
||||
|
||||
+3
-7
@@ -33,9 +33,6 @@ struct Entry {
|
||||
|
||||
struct SubscriptionImpl final : public OperationBase, public Subscription
|
||||
{
|
||||
// for use in log messages, even after cancel()
|
||||
std::string channelName;
|
||||
|
||||
evevent ackTick;
|
||||
|
||||
// const after exec()
|
||||
@@ -75,8 +72,8 @@ struct SubscriptionImpl final : public OperationBase, public Subscription
|
||||
|
||||
INST_COUNTER(SubscriptionImpl);
|
||||
|
||||
explicit SubscriptionImpl(const evbase& loop)
|
||||
:OperationBase (Operation::Monitor, loop)
|
||||
explicit SubscriptionImpl(const evbase& loop, const std::string& name)
|
||||
:OperationBase (Operation::Monitor, loop, name)
|
||||
,ackTick(__FILE__, __LINE__,
|
||||
event_new(loop.base, -1, EV_TIMEOUT, &tickAckS, this))
|
||||
{}
|
||||
@@ -745,9 +742,8 @@ std::shared_ptr<Subscription> MonitorBuilder::exec()
|
||||
|
||||
auto context(ctx->impl->shared_from_this());
|
||||
|
||||
auto op(std::make_shared<SubscriptionImpl>(context->tcp_loop));
|
||||
auto op(std::make_shared<SubscriptionImpl>(context->tcp_loop, _name));
|
||||
op->self = op;
|
||||
op->channelName = std::move(_name);
|
||||
op->event = std::move(_event);
|
||||
op->onInit = std::move(_onInit);
|
||||
op->pvRequest = _buildReq();
|
||||
|
||||
Reference in New Issue
Block a user