mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 09:18:02 +00:00
add ref counting for cassandra callbacks
This commit is contained in:
@@ -474,7 +474,7 @@ public:
|
|||||||
if (next_->marker().size() == 0)
|
if (next_->marker().size() == 0)
|
||||||
return "";
|
return "";
|
||||||
else
|
else
|
||||||
return std::string{next_->marker().data()[0]};
|
return ripple::strHex(std::string{next_->marker().data()[0]});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ flatMapWriteCallback(CassFuture* fut, void* cbData)
|
|||||||
backend.throttleCv_.notify_all();
|
backend.throttleCv_.notify_all();
|
||||||
if (backend.numRequestsOutstanding_ == 0)
|
if (backend.numRequestsOutstanding_ == 0)
|
||||||
backend.syncCv_.notify_all();
|
backend.syncCv_.notify_all();
|
||||||
delete &requestParams;
|
int remaining = --requestParams.refs;
|
||||||
|
if (remaining == 0)
|
||||||
|
delete &requestParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +73,9 @@ flatMapWriteKeyCallback(CassFuture* fut, void* cbData)
|
|||||||
backend.throttleCv_.notify_all();
|
backend.throttleCv_.notify_all();
|
||||||
if (backend.numRequestsOutstanding_ == 0)
|
if (backend.numRequestsOutstanding_ == 0)
|
||||||
backend.syncCv_.notify_all();
|
backend.syncCv_.notify_all();
|
||||||
delete &requestParams;
|
int remaining = --requestParams.refs;
|
||||||
|
if (remaining == 0)
|
||||||
|
delete &requestParams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1315,6 +1315,7 @@ public:
|
|||||||
bool isDeleted;
|
bool isDeleted;
|
||||||
|
|
||||||
uint32_t currentRetries = 0;
|
uint32_t currentRetries = 0;
|
||||||
|
std::atomic<int> refs = 1;
|
||||||
|
|
||||||
WriteCallbackData(
|
WriteCallbackData(
|
||||||
CassandraFlatMapBackend const* f,
|
CassandraFlatMapBackend const* f,
|
||||||
@@ -1330,6 +1331,8 @@ public:
|
|||||||
, isCreated(isCreated)
|
, isCreated(isCreated)
|
||||||
, isDeleted(isDeleted)
|
, isDeleted(isDeleted)
|
||||||
{
|
{
|
||||||
|
if (isCreated or isDeleted)
|
||||||
|
refs = 2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user