feat: remove the dependency of tls memory for redis_parser (#686)
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 @@
// 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));