You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ja...@apache.org on 2020/12/07 06:58:18 UTC
[incubator-brpc] branch master updated: Call DestroyData for
ResetData returning false
This is an automated email from the ASF dual-hosted git repository.
jamesge pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git
The following commit(s) were added to refs/heads/master by this push:
new f45d50d Call DestroyData for ResetData returning false
f45d50d is described below
commit f45d50dca21816ac50f5c5616d71f7421b2575d8
Author: jamesge <jg...@gmail.com>
AuthorDate: Mon Dec 7 14:58:02 2020 +0800
Call DestroyData for ResetData returning false
---
src/brpc/data_factory.h | 3 ++-
src/brpc/simple_data_pool.cpp | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/brpc/data_factory.h b/src/brpc/data_factory.h
index a487262..a0950f8 100644
--- a/src/brpc/data_factory.h
+++ b/src/brpc/data_factory.h
@@ -40,7 +40,8 @@ public:
// Overwrite this method to reset the data before reuse. Nothing done by default.
// Returns
// true: the data can be kept for future reuse
- // false: the data was already destroyed and should NOT be reused.
+ // false: the data is improper to be reused and should be sent to
+ // DestoryData() immediately after calling this method
virtual bool ResetData(void*) const { return true; }
};
diff --git a/src/brpc/simple_data_pool.cpp b/src/brpc/simple_data_pool.cpp
index 9374da4..fe1d324 100644
--- a/src/brpc/simple_data_pool.cpp
+++ b/src/brpc/simple_data_pool.cpp
@@ -108,7 +108,7 @@ void SimpleDataPool::Return(void* data) {
return;
}
if (!_factory->ResetData(data)) {
- return;
+ return _factory->DestroyData(data);
}
std::unique_lock<butil::Mutex> mu(_mutex);
if (_capacity == _size) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org