You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by wu...@apache.org on 2021/01/27 08:42:08 UTC
[incubator-pegasus] branch master updated: feat: remove the
dependency of tls memory for redis_parser (#686)
This is an automated email from the ASF dual-hosted git repository.
wutao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 322f54e feat: remove the dependency of tls memory for redis_parser (#686)
322f54e is described below
commit 322f54ee40f83cc5349ac8172231ede00b086292
Author: zhao liwei <zl...@163.com>
AuthorDate: Wed Jan 27 16:42:02 2021 +0800
feat: remove the dependency of tls memory for redis_parser (#686)
---
src/redis_protocol/proxy_lib/redis_parser.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/redis_protocol/proxy_lib/redis_parser.cpp b/src/redis_protocol/proxy_lib/redis_parser.cpp
index f08276b..65c05ac 100644
--- a/src/redis_protocol/proxy_lib/redis_parser.cpp
+++ b/src/redis_protocol/proxy_lib/redis_parser.cpp
@@ -299,12 +299,9 @@ bool redis_parser::parse_stream()
// string content + CR + LF
if (_total_length >= _current_str.length + 2) {
if (_current_str.length > 0) {
- char *ptr =
- reinterpret_cast<char *>(dsn::tls_trans_malloc(_current_str.length));
- std::shared_ptr<char> str_data(ptr,
- [](char *ptr) { dsn::tls_trans_free(ptr); });
- eat_all(str_data.get(), _current_str.length);
- _current_str.data.assign(std::move(str_data), 0, _current_str.length);
+ std::string str_data(_current_str.length, '\0');
+ eat_all(const_cast<char *>(str_data.data()), _current_str.length);
+ _current_str.data = dsn::blob::create_from_bytes(std::move(str_data));
}
dverify(eat(CR));
dverify(eat(LF));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org